pgbackrest.git / summary / log / commit / refs

commit    b33cabe08c33e29eb8aef65dd46b2c1f3cf2d186
Author:   David Steele <dwsteele@users.noreply.github.com>
Commit:   GitHub <noreply@github.com>
Date:     Fri Feb 25 16:51:40 2022 +0000

    Allow case-insensitive matching of HTTP connection header values.
    
    The specification allows values for the connection header to be case-insensitive. See https://www.rfc-editor.org/rfc/rfc7230#section-6.1.


doc/xml/release.xml | 18 ++++++++++++++++++ src/common/io/http/response.c | 7 ++++--- test/src/module/common/ioHttpTest.c | 2 +- 3 files changed, 23 insertions(+), 4 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 7462ca7af..d5118fa27 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -33,6 +33,19 @@ <p>Retry errors in S3 batch file delete.</p> </release-item> + + <release-item> + <github-issue id="1638"/> + <github-pull-request id="1675"/> + + <release-item-contributor-list> + <release-item-ideator id="remi.vidier"/> + <release-item-contributor id="david.steele"/> + <release-item-reviewer id="reid.thompson"/> + </release-item-contributor-list> + + <p>Allow case-insensitive matching of <proper>HTTP</proper> <id>connection</id> header values.</p> + </release-item> </release-bug-list> <release-feature-list> @@ -11310,6 +11323,11 @@ <contributor-id type="github">Rakshitha-BR</contributor-id> </contributor> + <contributor id="remi.vidier"> + <contributor-name-display>R&amp;eacute;mi Vidier</contributor-name-display> + <contributor-id type="github">vidierr</contributor-id> + </contributor> + <contributor id="rohit.raveendran"> <contributor-name-display>Rohit Raveendran</contributor-name-display> <contributor-id type="github">rohitrav33ndran</contributor-id> diff --git a/src/common/io/http/response.c b/src/common/io/http/response.c index 3efdd9d77..df2f28d8c 100644 --- a/src/common/io/http/response.c +++ b/src/common/io/http/response.c @@ -275,8 +275,6 @@ httpResponseNew(HttpSession *session, const String *verb, bool contentCache) String *headerKey = strLower(strTrim(strSubN(header, 0, (size_t)colonPos))); String *headerValue = strTrim(strSub(header, (size_t)colonPos + 1)); - httpHeaderAdd(this->pub.header, headerKey, headerValue); - // Read transfer encoding (only chunked is supported) if (strEq(headerKey, HTTP_HEADER_TRANSFER_ENCODING_STR)) { @@ -300,8 +298,11 @@ httpResponseNew(HttpSession *session, const String *verb, bool contentCache) // If the server notified of a closed connection then close the client connection after reading content. This // prevents doing a retry on the next request when using the closed connection. - if (strEq(headerKey, HTTP_HEADER_CONNECTION_STR) && strEq(headerValue, HTTP_VALUE_CONNECTION_CLOSE_STR)) + if (strEq(headerKey, HTTP_HEADER_CONNECTION_STR) && strEq(strLower(headerValue), HTTP_VALUE_CONNECTION_CLOSE_STR)) this->closeOnContentEof = true; + + // Add after header checks in case the value was modified + httpHeaderAdd(this->pub.header, headerKey, headerValue); } while (1); diff --git a/test/src/module/common/ioHttpTest.c b/test/src/module/common/ioHttpTest.c index 360e06a5f..ab2d7b885 100644 --- a/test/src/module/common/ioHttpTest.c +++ b/test/src/module/common/ioHttpTest.c @@ -638,7 +638,7 @@ testRun(void) hrnServerScriptExpectZ( http, "GET /path/file%201.txt HTTP/1.1\r\n" TEST_USER_AGENT "content-length:30\r\n\r\n" "012345678901234567890123456789"); - hrnServerScriptReplyZ(http, "HTTP/1.1 200 OK\r\nConnection:close\r\n\r\n01234567890123456789012345678901"); + hrnServerScriptReplyZ(http, "HTTP/1.1 200 OK\r\nConnection:ClosE\r\n\r\n01234567890123456789012345678901"); hrnServerScriptClose(http); [parent: 632071232344]