You've already forked pgbackrest
mirror of
https://github.com/pgbackrest/pgbackrest.git
synced 2025-09-16 09:06:18 +02:00
Add zero-length chunked content test to common/ioHttp unit.
It seems wasteful to chunk content when there is nothing to send but make sure we handle it gracefully just in case a server decides to do it.
This commit is contained in:
@@ -769,6 +769,24 @@ testRun(void)
|
||||
TEST_RESULT_VOID(ioRead(httpResponseIoRead(response), buffer), "read response");
|
||||
TEST_RESULT_STR_Z(strNewBuf(buffer), "01234567890123456789012345678901012", "check response");
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("request with zero-length chunked content");
|
||||
|
||||
hrnServerScriptExpectZ(http, "GET / HTTP/1.1\r\n" TEST_USER_AGENT "\r\n");
|
||||
hrnServerScriptReplyZ(
|
||||
http,
|
||||
"HTTP/1.1 200 OK\r\nTransfer-Encoding:chunked\r\n\r\n"
|
||||
"0\r\n\r\n");
|
||||
|
||||
TEST_ASSIGN(response, httpRequestResponse(httpRequestNewP(client, STRDEF("GET"), STRDEF("/")), false), "request");
|
||||
TEST_RESULT_STR_Z(
|
||||
httpHeaderToLog(httpResponseHeader(response)), "{transfer-encoding: 'chunked'}", "check response headers");
|
||||
|
||||
buffer = bufNew(0);
|
||||
|
||||
TEST_RESULT_VOID(ioRead(httpResponseIoRead(response), buffer), "read response");
|
||||
TEST_RESULT_STR_Z(strNewBuf(buffer), "", "check response");
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
TEST_TITLE("close connection and end server process");
|
||||
|
||||
|
Reference in New Issue
Block a user