diff options
author | Alexey Efimov <xeno@prnwatch.com> | 2022-05-20 19:18:30 +0300 |
---|---|---|
committer | Alexey Efimov <xeno@prnwatch.com> | 2022-05-20 19:18:30 +0300 |
commit | a4c79297abc662140028caf7fb04e49dcbccb975 (patch) | |
tree | 5ad9cf6459ecf1d61beb7a95893076671dca3f00 /library | |
parent | 1c96c3345be1820c6be4f4f307e12e6c20b2b384 (diff) | |
download | ydb-a4c79297abc662140028caf7fb04e49dcbccb975.tar.gz |
fixes for redirections KIKIMR-14742
ref:1c576bf8c00f29291ab91c1039b8ad64798ba93d
Diffstat (limited to 'library')
-rw-r--r-- | library/cpp/actors/http/http.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/library/cpp/actors/http/http.cpp b/library/cpp/actors/http/http.cpp index 20dea47573..4f8df434ca 100644 --- a/library/cpp/actors/http/http.cpp +++ b/library/cpp/actors/http/http.cpp @@ -374,7 +374,7 @@ THttpOutgoingResponsePtr THttpIncomingRequest::CreateResponseString(TStringBuf d if (parser.HaveBody()) { if (parser.ContentType && !Endpoint->CompressContentTypes.empty()) { TStringBuf contentType = parser.ContentType.Before(';'); - Trim(ContentType, ' '); + Trim(contentType, ' '); if (Count(Endpoint->CompressContentTypes, contentType) != 0) { if (response->EnableCompression()) { headers.Erase("Content-Length"); // we will need new length after compression @@ -432,6 +432,13 @@ THttpOutgoingResponsePtr THttpIncomingRequest::CreateResponse(TStringBuf status, } if (!contentType.empty() && !body.empty()) { response->Set<&THttpResponse::ContentType>(contentType); + if (!Endpoint->CompressContentTypes.empty()) { + contentType = contentType.Before(';'); + Trim(contentType, ' '); + if (Count(Endpoint->CompressContentTypes, contentType) != 0) { + response->EnableCompression(); + } + } } if (lastModified) { response->Set<&THttpResponse::LastModified>(lastModified.FormatGmTime("%a, %d %b %Y %H:%M:%S GMT")); |