diff options
author | ng0 <ng0@n0.is> | 2019-02-25 11:15:00 +0000 |
---|---|---|
committer | ng0 <ng0@n0.is> | 2019-02-25 11:15:00 +0000 |
commit | 2a251478463006d1deacf1610987d75054ba4fb8 (patch) | |
tree | 41bfad1ee4f0d2cee35c88d7de02ce0356307379 /tests/server | |
parent | 810ed5cbb8e14bd8c1f9bfed76b3811a1cdd0207 (diff) | |
parent | f3294d9d86e6a7915a967efff2842089b8b0d071 (diff) | |
download | gnurl-2a251478463006d1deacf1610987d75054ba4fb8.tar.gz gnurl-2a251478463006d1deacf1610987d75054ba4fb8.tar.bz2 gnurl-2a251478463006d1deacf1610987d75054ba4fb8.zip |
Merge tag 'curl-7_64_0'
curl 7.64.0
Diffstat (limited to 'tests/server')
-rw-r--r-- | tests/server/sws.c | 22 | ||||
-rw-r--r-- | tests/server/util.c | 2 |
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c index cf3d291d9..87c0204c9 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -253,6 +253,9 @@ SIG_ATOMIC_T got_exit_signal = 0; static volatile int exit_signal = 0; +/* work around for handling trailing headers */ +static int already_recv_zeroed_chunk = FALSE; + /* signal handler that will be triggered to indicate that the program should finish its execution in a controlled manner as soon as possible. The first time this is called it will set got_exit_signal to one and @@ -755,10 +758,27 @@ static int ProcessRequest(struct httprequest *req) chunked = TRUE; } + if(chunked) { - if(strstr(req->reqbuf, "\r\n0\r\n\r\n")) + if(strstr(req->reqbuf, "\r\n0\r\n\r\n")) { /* end of chunks reached */ return 1; /* done */ + } + else if(strstr(req->reqbuf, "\r\n0\r\n")) { + char *last_crlf_char = strstr(req->reqbuf, "\r\n\r\n"); + while(TRUE) { + if(!strstr(last_crlf_char + 4, "\r\n\r\n")) + break; + last_crlf_char = strstr(last_crlf_char + 4, "\r\n\r\n"); + } + if(last_crlf_char && + last_crlf_char > strstr(req->reqbuf, "\r\n0\r\n")) + return 1; + already_recv_zeroed_chunk = TRUE; + return 0; + } + else if(already_recv_zeroed_chunk && strstr(req->reqbuf, "\r\n\r\n")) + return 1; else return 0; /* not done */ } diff --git a/tests/server/util.c b/tests/server/util.c index df1e35da0..c3935f58a 100644 --- a/tests/server/util.c +++ b/tests/server/util.c @@ -422,7 +422,7 @@ static struct timeval tvnow(void) DWORD milliseconds = GetTickCount(); #endif now.tv_sec = (long)(milliseconds / 1000); - now.tv_usec = (milliseconds % 1000) * 1000; + now.tv_usec = (long)((milliseconds % 1000) * 1000); return now; } |