start_pos = string::npos;
52 if(start_pos != string::npos) {
53 size_tpos = url.find(
'/', start_pos);
54 if(pos != string::npos) {
55host = url.substr(start_pos, pos - start_pos);
56 file= url.substr(pos + 1);
63last_modified.clear();
64 stringerr_msg =
"Specified URL is not valid: '";
68 stringftp_host, ftp_file;
75ftp.read(&
buffer[0], 256*2);
76 size_t count= ftp.gcount();
77 if(
count== 0 || ftp.bad())
81 unsigned chardigest[16];
82 md5.Finalize (digest);
83last_modified =
md5.GetHexSum();
95 if(status_code != 200)
98list<string> header_tags;
100 for(
const auto& h : header_tags) {
106last_modified =
value;
113 stringuser_header =
"If-Modified-Since: "+ last_modified;
120list<string> header_tags;
122 for(
const auto& h : header_tags) {
128last_modified =
value;
140 const auto& headers = response.
Headers().
Get();
141 for(
const auto& header : headers) {
143 string value= header.second.front();
CConn_FtpStream specialization (ctor) for download.
This stream exchanges data with an HTTP server located at the URL: http[s]://host[:port]/path[?...
static void md5(const char *src, const char *out)
int GetStatusCode(void) const
Get the last seen HTTP status code, if available.
const string & GetHTTPHeader(void) const
Get the last seen HTTP header text, if available.
@ fHTTP_NoAutoRetry
No auto-retries allowed.
@ fHTTP_AutoReconnect
See HTTP_CreateConnectorEx()
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
static Uint8 GetRemoteFileSize(const string &url)
Returns the size of the remote file.
static bool IfModifiedSince(const string &url, string &last_modified)
Works with HTTP(s) protocol returns true if url was modified since last_modified date if true last_mo...
static void GetLastModified(const string &url, string &last_modified)
HTTP: Returns header's Last-Modified in the last_modified parameter FTP: Returns MD5 of first 512 byt...
const THeaders & Get() const
int GetStatusCode(void) const
Get response status code.
const CHttpHeaders & Headers(void) const
Get incoming HTTP headers.
CHttpResponse g_HttpGet(const CUrl &url, const CHttpParam ¶m)
Shortcut for GET request.
uint64_t Uint8
8-byte (64-bit) unsigned integer
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static void TruncateSpacesInPlace(string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string (in-place)
static bool StartsWith(const CTempString str, const CTempString start, ECase use_case=eCase)
Check if a string starts with a specified prefix value.
static Uint8 StringToUInt8(const CTempString str, TStringToNumFlags flags=0, int base=10)
Convert string to Uint8.
static bool SplitInTwo(const CTempString str, const CTempString delim, string &str1, string &str2, TSplitFlags flags=0)
Split a string into two pieces using the specified delimiters.
static bool EqualNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive equality of a substring with another string.
@ eNocase
Case insensitive compare.
unsigned int usec
microseconds (modulo 1,000,000)
CMD5 - class for computing Message Digest version 5 checksums.
const struct ncbi::grid::netcache::search::fields::KEY key
const GenericPointer< typename T::ValueType > T2 value
static void s_GetFtpHostAndFile(const string &url, string &host, string &file)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4