Updated the anonheader function to use the new anonymous API. Removed the

hack for the POST method in clientreq.
This commit is contained in:
Robert James Kaes 2000-03-31 20:13:36 +00:00
parent 2562d28129
commit dede5f36a8

View File

@ -1,4 +1,4 @@
/* $Id: reqs.c,v 1.5 2000-03-29 16:17:37 rjkaes Exp $ /* $Id: reqs.c,v 1.6 2000-03-31 20:13:36 rjkaes Exp $
* *
* This is where all the work in tinyproxy is actually done. Incoming * This is where all the work in tinyproxy is actually done. Incoming
* connections are added to the active list of connections and then the header * connections are added to the active list of connections and then the header
@ -54,6 +54,7 @@
#include "filter.h" #include "filter.h"
#include "uri.h" #include "uri.h"
#include "regexp.h" #include "regexp.h"
#include "anonymous.h"
/* chris - for asynchronous DNS */ /* chris - for asynchronous DNS */
#include "dnscache.h" #include "dnscache.h"
@ -281,16 +282,6 @@ static int clientreq(struct conn_s *connptr)
/* Add the rewritten request to the buffer */ /* Add the rewritten request to the buffer */
unshift_buffer(connptr->cbuffer, request, strlen(request)); unshift_buffer(connptr->cbuffer, request, strlen(request));
/*
* HACK HACK HACK: When we're sending a POST there is no restriction
* on the length of the header. If we don't let all the header lines
* through, the POST will not work. This _definitely_ needs to be
* fixed. - rjkaes
*/
if (xstrstr(inbuf, "POST ", 5, FALSE)) {
connptr->clientheader = TRUE;
}
COMMON_EXIT: COMMON_EXIT:
safefree(inbuf); safefree(inbuf);
free_uri(uri); free_uri(uri);
@ -366,26 +357,25 @@ static int clientreq_finish(struct conn_s *connptr)
*/ */
static int anonheader(char *line) static int anonheader(char *line)
{ {
struct allowedhdr_s *allowedptr = allowedhdrs; char *buffer, *ptr;
int ret;
assert(line); assert(line);
assert(allowedhdrs);
/* if ((ptr = xstrstr(line, ":", strlen(line), FALSE)) == NULL)
if (!xstrstr(line, "GET ", 4, FALSE) return 0;
|| !xstrstr(line, "POST ", 5, FALSE)
|| !xstrstr(line, "HEAD ", 5, FALSE))
return 1;
*/
for (allowedptr = allowedhdrs; allowedptr; ptr++;
allowedptr = allowedptr->next) {
if (!strncasecmp if ((buffer = xmalloc(ptr - line + 1)) == NULL)
(line, allowedptr->hdrname, strlen(allowedptr->hdrname))) { return 0;
return 1;
} memcpy(buffer, line, ptr - line);
} buffer[ptr - line] = '\0';
return 0;
ret = anon_search(buffer);
free(buffer);
return ret;
} }
/* /*
@ -410,7 +400,7 @@ static int readanonconn(struct conn_s *connptr)
safefree(line); safefree(line);
return 0; return 0;
} }
push_buffer(connptr->cbuffer, line, strlen(line)); push_buffer(connptr->cbuffer, line, strlen(line));
return 0; return 0;
} }