mirror of
https://github.com/curl/curl.git
synced 2026-07-24 14:07:16 +03:00
pipelining: removed
As previously planned and documented in DEPRECATE.md, all pipelining code is removed. Closes #3651
This commit is contained in:
parent
aba1c51553
commit
2f44e94efb
28 changed files with 190 additions and 1401 deletions
|
|
@ -156,8 +156,6 @@ auth_required if this is set and a POST/PUT is made without auth, the
|
|||
idle do nothing after receiving the request, just "sit idle"
|
||||
stream continuously send data to the client, never-ending
|
||||
writedelay: [secs] delay this amount between reply packets
|
||||
pipe: [num] tell the server to expect this many HTTP requests before
|
||||
sending back anything, to allow pipelining tests
|
||||
skip: [num] instructs the server to ignore reading this many bytes from a PUT
|
||||
or POST request
|
||||
|
||||
|
|
@ -188,7 +186,6 @@ ftp-ipv6
|
|||
ftps
|
||||
http
|
||||
http-ipv6
|
||||
http-pipe
|
||||
http-proxy
|
||||
http-unix
|
||||
https
|
||||
|
|
@ -354,7 +351,6 @@ Available substitute variables include:
|
|||
%HOST6IP - IPv6 address of the host running this test
|
||||
%HOSTIP - IPv4 address of the host running this test
|
||||
%HTTP6PORT - IPv6 port number of the HTTP server
|
||||
%HTTPPIPEPORT - Port number of the HTTP pipelining server
|
||||
%HTTPUNIXPATH - Path to the Unix socket of the HTTP server
|
||||
%HTTPPORT - Port number of the HTTP server
|
||||
%HTTPSPORT - Port number of the HTTPS server
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ test500 test501 test502 test503 test504 test505 test506 test507 test508 \
|
|||
test509 test510 test511 test512 test513 test514 test515 test516 test517 \
|
||||
test518 test519 test520 test521 test522 test523 test524 test525 test526 \
|
||||
test527 test528 test529 test530 test531 test532 test533 test534 test535 \
|
||||
test536 test537 test538 test539 test540 test541 test542 test543 test544 \
|
||||
test537 test538 test539 test540 test541 test542 test543 test544 \
|
||||
test545 test546 test547 test548 test549 test550 test551 test552 test553 \
|
||||
test554 test555 test556 test557 test558 test559 test560 test561 test562 \
|
||||
test563 test564 test565 test566 test567 test568 test569 test570 test571 \
|
||||
|
|
|
|||
|
|
@ -1,74 +0,0 @@
|
|||
<testcase>
|
||||
<info>
|
||||
<keywords>
|
||||
HTTP
|
||||
HTTP GET
|
||||
pipelining
|
||||
multi
|
||||
</keywords>
|
||||
</info>
|
||||
|
||||
<reply>
|
||||
<data>
|
||||
HTTP/1.1 404 Badness
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
ETag: "21025-dc7-39462498"
|
||||
Content-Length: 6
|
||||
Content-Type: text/html
|
||||
Funny-head: yesyes
|
||||
|
||||
hejsan
|
||||
</data>
|
||||
<data1>
|
||||
HTTP/1.1 200 Fine
|
||||
Date: Thu, 09 Nov 2010 14:49:00 GMT
|
||||
Content-Length: 13
|
||||
Connection: close
|
||||
Content-Type: text/html
|
||||
|
||||
fine content
|
||||
</data1>
|
||||
|
||||
<datacheck>
|
||||
fine content
|
||||
Finished!
|
||||
</datacheck>
|
||||
|
||||
<servercmd>
|
||||
pipe: 1
|
||||
</servercmd>
|
||||
</reply>
|
||||
|
||||
# Client-side
|
||||
<client>
|
||||
<server>
|
||||
http
|
||||
</server>
|
||||
# tool is what to use instead of 'curl'
|
||||
<tool>
|
||||
lib536
|
||||
</tool>
|
||||
|
||||
<name>
|
||||
HTTP GET multi two files with FAILONERROR and pipelining
|
||||
</name>
|
||||
<command>
|
||||
http://%HOSTIP:%HTTPPORT/536 http://%HOSTIP:%HTTPPORT/5360001
|
||||
</command>
|
||||
</client>
|
||||
|
||||
#
|
||||
# Verify data after the test has been "shot"
|
||||
<verify>
|
||||
<protocol>
|
||||
GET /536 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
GET /5360001 HTTP/1.1
|
||||
Host: %HOSTIP:%HTTPPORT
|
||||
Accept: */*
|
||||
|
||||
</protocol>
|
||||
</verify>
|
||||
</testcase>
|
||||
|
|
@ -16,7 +16,7 @@ noinst_PROGRAMS = chkhostname libauthretry libntlmconnect \
|
|||
lib500 lib501 lib502 lib503 lib504 lib505 lib506 lib507 lib508 lib509 \
|
||||
lib510 lib511 lib512 lib513 lib514 lib515 lib516 lib517 lib518 lib519 \
|
||||
lib520 lib521 lib523 lib524 lib525 lib526 lib527 lib529 lib530 lib532 \
|
||||
lib533 lib536 lib537 lib539 lib540 lib541 lib542 lib543 lib544 lib545 \
|
||||
lib533 lib537 lib539 lib540 lib541 lib542 lib543 lib544 lib545 \
|
||||
lib547 lib548 lib549 lib552 lib553 lib554 lib555 lib556 lib557 lib558 \
|
||||
lib559 lib560 lib562 lib564 lib565 lib566 lib567 lib568 lib569 lib570 \
|
||||
lib571 lib572 lib573 lib574 lib575 lib576 lib578 lib579 lib582 \
|
||||
|
|
@ -160,10 +160,6 @@ lib533_SOURCES = lib533.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
|||
lib533_LDADD = $(TESTUTIL_LIBS)
|
||||
lib533_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
lib536_SOURCES = lib536.c $(SUPPORTFILES) $(TESTUTIL) $(WARNLESS)
|
||||
lib536_LDADD = $(TESTUTIL_LIBS)
|
||||
lib536_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
lib537_SOURCES = lib537.c $(SUPPORTFILES) $(WARNLESS)
|
||||
lib537_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,142 +0,0 @@
|
|||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2011, 2017, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.haxx.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
***************************************************************************/
|
||||
#include "test.h"
|
||||
|
||||
#include <fcntl.h>
|
||||
|
||||
#include "testutil.h"
|
||||
#include "warnless.h"
|
||||
#include "memdebug.h"
|
||||
|
||||
#define TEST_HANG_TIMEOUT 60 * 1000
|
||||
|
||||
static int perform(CURLM *multi)
|
||||
{
|
||||
int handles;
|
||||
fd_set fdread, fdwrite, fdexcep;
|
||||
int res = 0;
|
||||
|
||||
for(;;) {
|
||||
struct timeval interval;
|
||||
int maxfd = -99;
|
||||
|
||||
interval.tv_sec = 0;
|
||||
interval.tv_usec = 100000L; /* 100 ms */
|
||||
|
||||
res_multi_perform(multi, &handles);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
res_test_timedout();
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
if(!handles)
|
||||
break; /* done */
|
||||
|
||||
FD_ZERO(&fdread);
|
||||
FD_ZERO(&fdwrite);
|
||||
FD_ZERO(&fdexcep);
|
||||
|
||||
res_multi_fdset(multi, &fdread, &fdwrite, &fdexcep, &maxfd);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
/* At this point, maxfd is guaranteed to be greater or equal than -1. */
|
||||
|
||||
res_select_test(maxfd + 1, &fdread, &fdwrite, &fdexcep, &interval);
|
||||
if(res)
|
||||
return res;
|
||||
|
||||
res_test_timedout();
|
||||
if(res)
|
||||
return res;
|
||||
}
|
||||
|
||||
return 0; /* success */
|
||||
}
|
||||
|
||||
int test(char *URL)
|
||||
{
|
||||
CURLM *multi = NULL;
|
||||
CURL *easy = NULL;
|
||||
int res = 0;
|
||||
|
||||
start_test_timing();
|
||||
|
||||
global_init(CURL_GLOBAL_ALL);
|
||||
|
||||
multi_init(multi);
|
||||
|
||||
easy_init(easy);
|
||||
|
||||
multi_setopt(multi, CURLMOPT_PIPELINING, 1L);
|
||||
|
||||
easy_setopt(easy, CURLOPT_WRITEFUNCTION, fwrite);
|
||||
easy_setopt(easy, CURLOPT_FAILONERROR, 1L);
|
||||
easy_setopt(easy, CURLOPT_URL, URL);
|
||||
|
||||
res_multi_add_handle(multi, easy);
|
||||
if(res) {
|
||||
printf("curl_multi_add_handle() 1 failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = perform(multi);
|
||||
if(res) {
|
||||
printf("retrieve 1 failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
|
||||
curl_easy_reset(easy);
|
||||
|
||||
easy_setopt(easy, CURLOPT_FAILONERROR, 1L);
|
||||
easy_setopt(easy, CURLOPT_URL, libtest_arg2);
|
||||
|
||||
res_multi_add_handle(multi, easy);
|
||||
if(res) {
|
||||
printf("curl_multi_add_handle() 2 failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
res = perform(multi);
|
||||
if(res) {
|
||||
printf("retrieve 2 failed\n");
|
||||
goto test_cleanup;
|
||||
}
|
||||
|
||||
curl_multi_remove_handle(multi, easy);
|
||||
|
||||
test_cleanup:
|
||||
|
||||
/* undocumented cleanup sequence - type UB */
|
||||
|
||||
curl_easy_cleanup(easy);
|
||||
curl_multi_cleanup(multi);
|
||||
curl_global_cleanup();
|
||||
|
||||
printf("Finished!\n");
|
||||
|
||||
return res;
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) 1998 - 2018, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
* Copyright (C) 1998 - 2019, Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
|
|
@ -111,15 +111,12 @@ struct httprequest {
|
|||
bool ntlm; /* Authorization ntlm header found */
|
||||
int writedelay; /* if non-zero, delay this number of seconds between
|
||||
writes in the response */
|
||||
int pipe; /* if non-zero, expect this many requests to do a "piped"
|
||||
request/response */
|
||||
int skip; /* if non-zero, the server is instructed to not read this
|
||||
many bytes from a PUT/POST request. Ie the client sends N
|
||||
bytes said in Content-Length, but the server only reads N
|
||||
- skip bytes. */
|
||||
int rcmd; /* doing a special command, see defines above */
|
||||
int prot_version; /* HTTP version * 10 */
|
||||
bool pipelining; /* true if request is pipelined */
|
||||
int callcount; /* times ProcessRequest() gets called */
|
||||
bool connmon; /* monitor the state of the connection, log disconnects */
|
||||
bool upgrade; /* test case allows upgrade to http2 */
|
||||
|
|
@ -426,14 +423,6 @@ static int parse_servercmd(struct httprequest *req)
|
|||
logmsg("swsclose: close this connection after response");
|
||||
req->close = TRUE;
|
||||
}
|
||||
else if(1 == sscanf(cmd, "pipe: %d", &num)) {
|
||||
logmsg("instructed to allow a pipe size of %d", num);
|
||||
if(num < 0)
|
||||
logmsg("negative pipe size ignored");
|
||||
else if(num > 0)
|
||||
req->pipe = num-1; /* decrease by one since we don't count the
|
||||
first request in this number */
|
||||
}
|
||||
else if(1 == sscanf(cmd, "skip: %d", &num)) {
|
||||
logmsg("instructed to skip this number of bytes %d", num);
|
||||
req->skip = num;
|
||||
|
|
@ -706,11 +695,6 @@ static int ProcessRequest(struct httprequest *req)
|
|||
}
|
||||
}
|
||||
|
||||
if(req->pipe)
|
||||
/* we do have a full set, advance the checkindex to after the end of the
|
||||
headers, for the pipelining case mostly */
|
||||
req->checkindex += (end - line) + strlen(end_of_headers);
|
||||
|
||||
/* **** Persistence ****
|
||||
*
|
||||
* If the request is a HTTP/1.0 one, we close the connection unconditionally
|
||||
|
|
@ -844,8 +828,7 @@ static int ProcessRequest(struct httprequest *req)
|
|||
if(strstr(req->reqbuf, "Connection: close"))
|
||||
req->open = FALSE; /* close connection after this request */
|
||||
|
||||
if(!req->pipe &&
|
||||
req->open &&
|
||||
if(req->open &&
|
||||
req->prot_version >= 11 &&
|
||||
end &&
|
||||
req->reqbuf + req->offset > end + strlen(end_of_headers) &&
|
||||
|
|
@ -855,19 +838,6 @@ static int ProcessRequest(struct httprequest *req)
|
|||
/* If we have a persistent connection, HTTP version >= 1.1
|
||||
and GET/HEAD request, enable pipelining. */
|
||||
req->checkindex = (end - req->reqbuf) + strlen(end_of_headers);
|
||||
req->pipelining = TRUE;
|
||||
}
|
||||
|
||||
while(req->pipe) {
|
||||
if(got_exit_signal)
|
||||
return 1; /* done */
|
||||
/* scan for more header ends within this chunk */
|
||||
line = &req->reqbuf[req->checkindex];
|
||||
end = strstr(line, end_of_headers);
|
||||
if(!end)
|
||||
break;
|
||||
req->checkindex += (end - line) + strlen(end_of_headers);
|
||||
req->pipe--;
|
||||
}
|
||||
|
||||
/* If authentication is required and no auth was provided, end now. This
|
||||
|
|
@ -951,13 +921,8 @@ storerequest_cleanup:
|
|||
|
||||
static void init_httprequest(struct httprequest *req)
|
||||
{
|
||||
/* Pipelining is already set, so do not initialize it here. Only initialize
|
||||
checkindex and offset if pipelining is not set, since in a pipeline they
|
||||
need to be inherited from the previous request. */
|
||||
if(!req->pipelining) {
|
||||
req->checkindex = 0;
|
||||
req->offset = 0;
|
||||
}
|
||||
req->checkindex = 0;
|
||||
req->offset = 0;
|
||||
req->testno = DOCNUMBER_NOTHING;
|
||||
req->partno = 0;
|
||||
req->connect_request = FALSE;
|
||||
|
|
@ -967,7 +932,6 @@ static void init_httprequest(struct httprequest *req)
|
|||
req->cl = 0;
|
||||
req->digest = FALSE;
|
||||
req->ntlm = FALSE;
|
||||
req->pipe = 0;
|
||||
req->skip = 0;
|
||||
req->writedelay = 0;
|
||||
req->rcmd = RCMD_NORMALREQ;
|
||||
|
|
@ -991,17 +955,6 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
|
|||
char *pipereq = NULL;
|
||||
size_t pipereq_length = 0;
|
||||
|
||||
if(req->pipelining) {
|
||||
pipereq = reqbuf + req->checkindex;
|
||||
pipereq_length = req->offset - req->checkindex;
|
||||
|
||||
/* Now that we've got the pipelining info we can reset the
|
||||
pipelining-related vars which were skipped in init_httprequest */
|
||||
req->pipelining = FALSE;
|
||||
req->checkindex = 0;
|
||||
req->offset = 0;
|
||||
}
|
||||
|
||||
if(req->offset >= REQBUFSIZ-1) {
|
||||
/* buffer is already full; do nothing */
|
||||
overflow = 1;
|
||||
|
|
@ -1051,11 +1004,6 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
|
|||
req->done_processing = ProcessRequest(req);
|
||||
if(got_exit_signal)
|
||||
return -1;
|
||||
if(req->done_processing && req->pipe) {
|
||||
logmsg("Waiting for another piped request");
|
||||
req->done_processing = 0;
|
||||
req->pipe--;
|
||||
}
|
||||
}
|
||||
|
||||
if(overflow || (req->offset == REQBUFSIZ-1 && got > 0)) {
|
||||
|
|
@ -1075,7 +1023,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
|
|||
|
||||
/* at the end of a request dump it to an external file */
|
||||
if(fail || req->done_processing)
|
||||
storerequest(reqbuf, req->pipelining ? req->checkindex : req->offset);
|
||||
storerequest(reqbuf, req->offset);
|
||||
if(got_exit_signal)
|
||||
return -1;
|
||||
|
||||
|
|
@ -1598,7 +1546,6 @@ static void http_connect(curl_socket_t *infdp,
|
|||
logmsg("====> TCP_NODELAY for client DATA connection failed");
|
||||
}
|
||||
#endif
|
||||
req2.pipelining = FALSE;
|
||||
init_httprequest(&req2);
|
||||
while(!req2.done_processing) {
|
||||
err = get_request(datafd, &req2);
|
||||
|
|
@ -2281,7 +2228,6 @@ int main(int argc, char *argv[])
|
|||
the pipelining struct field must be initialized previously to FALSE
|
||||
every time a new connection arrives. */
|
||||
|
||||
req.pipelining = FALSE;
|
||||
init_httprequest(&req);
|
||||
|
||||
for(;;) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue