diff options
author | dimanne <dimanne@yandex-team.ru> | 2022-02-10 16:49:48 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:48 +0300 |
commit | 93d66104be406c5b8cdfce7be5546d72d83b547e (patch) | |
tree | 5b4284b97105f480aa2b1ffc564e8f8e5b689df9 /library/cpp/http/fetch | |
parent | b3eef5b52437f05851a3e8fb489a68db0132657b (diff) | |
download | ydb-93d66104be406c5b8cdfce7be5546d72d83b547e.tar.gz |
Restoring authorship annotation for <dimanne@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/http/fetch')
-rw-r--r-- | library/cpp/http/fetch/exthttpcodes.h | 2 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpfetcher.h | 32 | ||||
-rw-r--r-- | library/cpp/http/fetch/httpparser.h | 8 |
3 files changed, 21 insertions, 21 deletions
diff --git a/library/cpp/http/fetch/exthttpcodes.h b/library/cpp/http/fetch/exthttpcodes.h index 6b525052cd..793d286c23 100644 --- a/library/cpp/http/fetch/exthttpcodes.h +++ b/library/cpp/http/fetch/exthttpcodes.h @@ -45,7 +45,7 @@ enum ExtHttpCodes { HTTP_PROXY_ERROR = 1036, HTTP_SSL_ERROR = 1037, HTTP_CACHED_COPY_NOT_FOUND = 1038, - HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING = 1039, + HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING = 1039, HTTP_FETCHER_BAD_RESPONSE = 1040, HTTP_FETCHER_MB_ERROR = 1041, HTTP_SSL_CERT_ERROR = 1042, diff --git a/library/cpp/http/fetch/httpfetcher.h b/library/cpp/http/fetch/httpfetcher.h index 7fc251afd2..b6bd038a94 100644 --- a/library/cpp/http/fetch/httpfetcher.h +++ b/library/cpp/http/fetch/httpfetcher.h @@ -96,12 +96,12 @@ public: if ((got = TAgent::read(bufptr, buffree)) < 0) { fetcherr = errno; if (errno == EINTR) - header->error = HTTP_INTERRUPTED; + header->error = HTTP_INTERRUPTED; else if (errno == ETIMEDOUT) - header->error = HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING; - else - header->error = HTTP_CONNECTION_LOST; - + header->error = HTTP_TIMEDOUT_WHILE_BYTES_RECEIVING; + else + header->error = HTTP_CONNECTION_LOST; + break; } @@ -111,7 +111,7 @@ public: buffree -= got; THttpParser<TCheck>::Parse(parsebuf, got); - + if (header->error) break; //if ANY error ocurred we will stop download that file or will have unprognosed stream position until MAX size reached @@ -139,20 +139,20 @@ public: } } while (THttpParser<TCheck>::GetState() > THttpParser<TCheck>::hp_eof); - i64 Adjustment = 0; - if (!header->error) { + i64 Adjustment = 0; + if (!header->error) { if (header->transfer_chunked) { - Adjustment = header->header_size + header->entity_size - bufsize - 1; + Adjustment = header->header_size + header->entity_size - bufsize - 1; } else if (header->content_length >= 0) { - Adjustment = header->header_size + header->content_length - bufsize; - } + Adjustment = header->header_size + header->content_length - bufsize; + } if (Adjustment > 0) - Adjustment = 0; - } - + Adjustment = 0; + } + if (buf) { - TAlloc::Shrink(buf, buflen - buffree + Adjustment); - + TAlloc::Shrink(buf, buflen - buffree + Adjustment); + if (TWriter::Write(buf, buflen - buffree) < 0) ret = EIO; } diff --git a/library/cpp/http/fetch/httpparser.h b/library/cpp/http/fetch/httpparser.h index 769828e4ae..cd7228055b 100644 --- a/library/cpp/http/fetch/httpparser.h +++ b/library/cpp/http/fetch/httpparser.h @@ -174,10 +174,10 @@ protected: case hp_read_alive: Header->entity_size += size; - if (Header->entity_size >= Header->content_length) { + if (Header->entity_size >= Header->content_length) { State = hp_eof; } - + TCheck::CheckDocPart(buf, size, Header); if (isReader) return size; @@ -314,8 +314,8 @@ public: buf = Ptr; Ptr = (char*)Ptr + Chunk; Size -= Chunk; - if (State == hp_eof) { - Size = 0; + if (State == hp_eof) { + Size = 0; Eoferr = 0; } else if (State == hp_error) return Eoferr = -1; |