From: Fabian Keil Date: Sat, 10 May 2008 13:23:38 +0000 (+0000) Subject: Don't provide get_header() with the whole client state X-Git-Tag: v_3_0_9~108 X-Git-Url: http://www.privoxy.org/gitweb/?p=privoxy.git;a=commitdiff_plain;h=0037521e356511ffd45f769e732e9bd4c120da0f Don't provide get_header() with the whole client state structure when it only needs access to csp->iob. --- diff --git a/jcc.c b/jcc.c index b2a28818..06ce04ae 100644 --- a/jcc.c +++ b/jcc.c @@ -1,4 +1,4 @@ -const char jcc_rcs[] = "$Id: jcc.c,v 1.176 2008/05/10 11:37:57 fabiankeil Exp $"; +const char jcc_rcs[] = "$Id: jcc.c,v 1.177 2008/05/10 11:51:12 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/jcc.c,v $ @@ -33,6 +33,9 @@ const char jcc_rcs[] = "$Id: jcc.c,v 1.176 2008/05/10 11:37:57 fabiankeil Exp $" * * Revisions : * $Log: jcc.c,v $ + * Revision 1.177 2008/05/10 11:51:12 fabiankeil + * Make the "read the rest of the headers" loop a bit more readable. + * * Revision 1.176 2008/05/10 11:37:57 fabiankeil * - Instead of logging when the IIS5 hack is enabled, log when it fails. * - Remove useless comment. @@ -1477,7 +1480,7 @@ static jb_err get_server_headers(struct client_state *csp) int continue_hack_in_da_house = 0; char * header; - while (((header = get_header(csp)) != NULL) || continue_hack_in_da_house) + while (((header = get_header(csp->iob)) != NULL) || continue_hack_in_da_house) { if (header == NULL) { @@ -1985,7 +1988,7 @@ static void chat(struct client_state *csp) return; } - req = get_header(csp); + req = get_header(csp->iob); } while ((NULL != req) && ('\0' == *req)); @@ -2073,7 +2076,7 @@ static void chat(struct client_state *csp) init_list(headers); for (;;) { - p = get_header(csp); + p = get_header(csp->iob); if (p == NULL) { diff --git a/parsers.c b/parsers.c index 6c952c90..77568b8e 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.125 2008/04/17 14:40:49 fabiankeil Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.126 2008/05/03 16:40:45 fabiankeil Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -44,6 +44,12 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.125 2008/04/17 14:40:49 fabiankei * * Revisions : * $Log: parsers.c,v $ + * Revision 1.126 2008/05/03 16:40:45 fabiankeil + * Change content_filters_enabled()'s parameter from + * csp->action to action so it can be also used in the + * CGI code. Don't bother checking if there are filters + * loaded, as that's somewhat besides the point. + * * Revision 1.125 2008/04/17 14:40:49 fabiankeil * Provide get_http_time() with the buffer size so it doesn't * have to blindly assume that the buffer is big enough. @@ -1433,7 +1439,7 @@ jb_err decompress_iob(struct client_state *csp) * Description : This (odd) routine will parse the csp->iob * * Parameters : - * 1 : csp = Current client state (buffers, headers, etc...) + * 1 : iob = The I/O buffer to parse, usually csp->iob. * * Returns : Any one of the following: * @@ -1443,11 +1449,9 @@ jb_err decompress_iob(struct client_state *csp) * a complete header line. * *********************************************************************/ -char *get_header(struct client_state *csp) +char *get_header(struct iob *iob) { - struct iob *iob; char *p, *q, *ret; - iob = csp->iob; if ((iob->cur == NULL) || ((p = strchr(iob->cur, '\n')) == NULL)) diff --git a/parsers.h b/parsers.h index 161a9d65..ac3d339b 100644 --- a/parsers.h +++ b/parsers.h @@ -1,6 +1,6 @@ #ifndef PARSERS_H_INCLUDED #define PARSERS_H_INCLUDED -#define PARSERS_H_VERSION "$Id: parsers.h,v 1.41 2008/04/16 16:38:21 fabiankeil Exp $" +#define PARSERS_H_VERSION "$Id: parsers.h,v 1.42 2008/04/17 14:40:49 fabiankeil Exp $" /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.h,v $ @@ -43,6 +43,10 @@ * * Revisions : * $Log: parsers.h,v $ + * Revision 1.42 2008/04/17 14:40:49 fabiankeil + * Provide get_http_time() with the buffer size so it doesn't + * have to blindly assume that the buffer is big enough. + * * Revision 1.41 2008/04/16 16:38:21 fabiankeil * Don't pass the whole csp structure to flush_socket() * when it only needs a file descriptor and a buffer. @@ -268,7 +272,7 @@ extern const add_header_func_ptr add_server_headers[]; extern int flush_socket(jb_socket fd, struct iob *iob); extern jb_err add_to_iob(struct client_state *csp, char *buf, int n); extern jb_err decompress_iob(struct client_state *csp); -extern char *get_header(struct client_state *csp); +extern char *get_header(struct iob *iob); extern char *get_header_value(const struct list *header_list, const char *header_name); extern jb_err sed(const struct parsers pats[], const add_header_func_ptr more_headers[], struct client_state *csp); extern void get_http_time(int time_offset, char *buf, size_t buffer_size);