From 47bc727e644937b3d3cf8df692815038b169f7a6 Mon Sep 17 00:00:00 2001 From: joergs Date: Sat, 13 Oct 2001 12:51:51 +0000 Subject: [PATCH] Removed client_host, (was only required for the old 2.0.2-11 http://noijb. force-load), instead crumble Host: and add it (again) in client_host_adder (in case we get a HTTP/1.0 request without Host: header and forward it to a HTTP/1.1 server/proxy). --- parsers.c | 67 +++++++++++++++++++++++++++---------------------------- 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/parsers.c b/parsers.c index 46f11895..eef1fd61 100644 --- a/parsers.c +++ b/parsers.c @@ -1,4 +1,4 @@ -const char parsers_rcs[] = "$Id: parsers.c,v 1.34 2001/10/07 18:50:55 oes Exp $"; +const char parsers_rcs[] = "$Id: parsers.c,v 1.35 2001/10/09 22:39:21 jongfoster Exp $"; /********************************************************************* * * File : $Source: /cvsroot/ijbswa/current/parsers.c,v $ @@ -41,6 +41,10 @@ const char parsers_rcs[] = "$Id: parsers.c,v 1.34 2001/10/07 18:50:55 oes Exp $" * * Revisions : * $Log: parsers.c,v $ + * Revision 1.35 2001/10/09 22:39:21 jongfoster + * assert.h is also required under Win32, so moving out of #ifndef _WIN32 + * block. + * * Revision 1.34 2001/10/07 18:50:55 oes * Added server_content_encoding, renamed server_transfer_encoding * @@ -337,9 +341,7 @@ const struct parsers client_patterns[] = { #if defined(FEATURE_IMAGE_DETECT_MSIE) { "Accept:", 7, client_accept }, #endif /* defined(FEATURE_IMAGE_DETECT_MSIE) */ -#ifdef FEATURE_FORCE_LOAD - { "Host:", 5, client_host }, -#endif /* def FEATURE_FORCE_LOAD */ + { "Host:", 5, crumble }, /* { "if-modified-since:", 18, crumble }, */ { "Keep-Alive:", 11, crumble }, { "connection:", 11, crumble }, @@ -363,6 +365,7 @@ const struct parsers server_patterns[] = { void (* const add_client_headers[])(struct client_state *) = { + client_host_adder, client_cookie_adder, client_x_forwarded_adder, client_xtra_adder, @@ -1381,6 +1384,32 @@ char *client_accept(const struct parsers *v, const char *s, struct client_state /* the following functions add headers directly to the header list */ +/********************************************************************* + * + * Function : client_host_adder + * + * Description : (re)adds the host header. Called from `sed'. + * + * Parameters : + * 1 : csp = Current client state (buffers, headers, etc...) + * + * Returns : N/A + * + *********************************************************************/ +void client_host_adder(struct client_state *csp) +{ + char *p = NULL; + + p = strsav(p, "Host: "); + p = strsav(p, csp->http->hostport); + + log_error(LOG_LEVEL_HEADER, "addh: %s", p); + enlist(csp->headers, p); + + freez(p); +} + + /********************************************************************* * * Function : client_cookie_adder @@ -1623,36 +1652,6 @@ char *server_set_cookie(const struct parsers *v, const char *s, struct client_st } -#ifdef FEATURE_FORCE_LOAD -/********************************************************************* - * - * Function : client_host - * - * Description : Clean the FORCE_PREFIX out of the 'host' http - * header, if we use force - * - * Parameters : - * 1 : v = ignored - * 2 : s = header (from sed) to clean - * 3 : csp = Current client state (buffers, headers, etc...) - * - * Returns : A malloc'ed pointer to the cleaned host header - * - *********************************************************************/ -char *client_host(const struct parsers *v, const char *s, struct client_state *csp) -{ - char *cleanhost = strdup(s); - - if(csp->flags & CSP_FLAG_FORCED) - { - strclean(cleanhost, FORCE_PREFIX); - } - - return(cleanhost); -} -#endif /* def FEATURE_FORCE_LOAD */ - - #ifdef FEATURE_FORCE_LOAD /********************************************************************* * -- 2.39.2