OpenMS
Loading...
Searching...
No Matches
HTTPInputSource.h
Go to the documentation of this file.
1// Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2// SPDX-License-Identifier: BSD-3-Clause
3//
4// --------------------------------------------------------------------------
5// $Maintainer: Timo Sachsenberg $
6// $Authors: Julianus Pfeuffer, Timo Sachsenberg $
7// --------------------------------------------------------------------------
8
9#pragma once
10
13#include <OpenMS/config.h>
14
15#include <memory>
16#include <string>
17
18namespace OpenMS
19{
33 class OPENMS_DLLAPI HTTPInputSource
34 {
35public:
43 explicit HTTPInputSource(const std::string& url);
44
53 std::unique_ptr<InputStream> makeStream() const;
54
66 static Int64 objectSize(const std::string& url);
67
79 static std::string readRange(const std::string& url, Int64 offset, Int64 length);
80
86 static bool isURL(const std::string& url);
87
97 static std::string redactURL(const std::string& url);
98
107 static std::string redactURLs(const std::string& text);
108
120 static std::string redactURLs(const std::string& text, const std::string& url);
121
122private:
123 std::string url_;
124 };
125
126} // namespace OpenMS
Source for reading XML files from HTTP, HTTPS and FTP URLs, with libcurl.
Definition HTTPInputSource.h:34
std::string url_
Definition HTTPInputSource.h:123
std::unique_ptr< InputStream > makeStream() const
Starts a transfer of the resource and returns a stream of its (decompressed) content,...
static std::string redactURL(const std::string &url)
url without user info ("user:password@"), query and fragment, for log and error messages.
HTTPInputSource(const std::string &url)
A source for url.
static Int64 objectSize(const std::string &url)
The size of the resource at url, in bytes, as reported by the server.
static std::string readRange(const std::string &url, Int64 offset, Int64 length)
The bytes [offset, offset + length) of the resource at url (fewer at its end), with a range request.
static std::string redactURLs(const std::string &text, const std::string &url)
text redacted as by redactURLs(text), and also without the parts of url that redactURL() removes.
static std::string redactURLs(const std::string &text)
text with every "scheme://" URL in it redacted as by redactURL(), for diagnostics of other libraries.
static bool isURL(const std::string &url)
Whether url is an HTTP, HTTPS or FTP URL (starts with "http://", "https://" or "ftp://")
int64_t Int64
Signed integer type (64bit)
Definition Types.h:40
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19