From 496229ea38ba3c65c264c18d3b8c065a411c3625 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Wed, 15 Jan 2014 12:11:28 +0100 Subject: MINOR: add support for draining pending POST data This avoids sending a reset when the client uploads some data, though the amount of data still needs to remain low enough to fit in a single read. --- httpterm.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/httpterm.c b/httpterm.c index 0cb31fc..0292bd1 100644 --- a/httpterm.c +++ b/httpterm.c @@ -381,6 +381,10 @@ int strlcpy2(char *dst, const char *src, int size) { #define ERR_RETRYABLE 1 /* retryable error, may be cumulated */ #define ERR_FATAL 2 /* fatal error, may be cumulated */ +#define METH_HEAD 0 +#define METH_GET 1 +#define METH_POST 2 + static char chunk_pattern[] = "1\r\n"; #define CHUNK_LEN (sizeof(chunk_pattern)-1) @@ -454,6 +458,7 @@ struct session { int req_chunked; int req_nosplice; int req_random; + int req_meth; }; struct listener { @@ -525,6 +530,7 @@ int master_pipe[2], chunked_pipe[CHUNK_LEN][2], slave_pipe[2]; /* pipes used by int slave_pipe_usage = 0; struct pipe chunk_slave_pipe[CHUNK_LEN]; int pipesize = RESPSIZE; +int ignore_err; /* send zeroes instead of aligned data */ #define GFLAGS_SEND_ZERO 0x1 @@ -2371,6 +2377,12 @@ int process_cli(struct session *t) { t->uri = req->h; *ptr = '\0'; + t->req_meth = METH_GET; + if (*t->uri == 'P') + t->req_meth = METH_POST; + else if (*t->uri == 'H') + t->req_meth = METH_HEAD; + /* we'll check for the following URIs : * /?{s=|r=|t=