diff options
author | Daniel Stenberg <daniel@haxx.se> | 2002-02-25 09:42:58 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2002-02-25 09:42:58 +0000 |
commit | d86f9611b334f47b995d332f5900d0681fff4c3e (patch) | |
tree | 626c745c527b65adf6bc0edd54dedf5e518ab7e2 /tests/server | |
parent | 6a62fc4a40ab2e2dd26768dfa297ccb5299e50c3 (diff) |
support HUGE requests too
Diffstat (limited to 'tests/server')
-rw-r--r-- | tests/server/sws.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/tests/server/sws.c b/tests/server/sws.c index 9f3076aa5..6b6585007 100644 --- a/tests/server/sws.c +++ b/tests/server/sws.c @@ -135,13 +135,18 @@ void storerequest(char *reqbuf) } -#define REQBUFSIZ 4096 -#define MAXDOCNAMELEN 1024 +#define REQBUFSIZ 50000 +#define REQBUFSIZ_TXT "49999" + +/* very-big-path support */ +#define MAXDOCNAMELEN 40000 +#define MAXDOCNAMELEN_TXT "39999" + #define REQUEST_KEYWORD_SIZE 256 static int get_request(int sock, int *part) { - char reqbuf[REQBUFSIZ], doc[MAXDOCNAMELEN]; - char request[REQUEST_KEYWORD_SIZE]; + static char reqbuf[REQBUFSIZ], doc[MAXDOCNAMELEN]; + static char request[REQUEST_KEYWORD_SIZE]; unsigned int offset = 0; int prot_major, prot_minor; char logbuf[256]; @@ -177,7 +182,7 @@ static int get_request(int sock, int *part) /* dump the request to an external file */ storerequest(reqbuf); - if (sscanf(reqbuf, "%s %s HTTP/%d.%d", + if (sscanf(reqbuf, "%" REQBUFSIZ_TXT"s %" MAXDOCNAMELEN_TXT "s HTTP/%d.%d", request, doc, &prot_major, @@ -191,10 +196,14 @@ static int get_request(int sock, int *part) /* get the number after it */ if(ptr) { - sprintf(logbuf, "Got request: %s %s HTTP/%d.%d", - request, doc, prot_major, prot_minor); + if((strlen(doc) + strlen(request)) < 200) + sprintf(logbuf, "Got request: %s %s HTTP/%d.%d", + request, doc, prot_major, prot_minor); + else + sprintf(logbuf, "Got a *HUGE* request HTTP/%d.%d", + prot_major, prot_minor); logmsg(logbuf); - + if(!strncmp("/verifiedserver", ptr, 15)) { logmsg("Are-we-friendly question received"); return -2; |