You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1998/08/31 21:52:05 UTC

cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_cache.c proxy_http.c proxy_util.c

martin      98/08/31 12:52:04

  Modified:    src      CHANGES
               src/include ap_mmn.h
               src/modules/proxy mod_proxy.h proxy_cache.c proxy_http.c
                        proxy_util.c
  Log:
  As per Rick Ohnemus' <ri...@ecompcon.com> suggestion in PR#2914,
  apache now (logs and) ignores duplicate occurences of
  "HTTP/1.0 200 OK" lines often generated by IIS servers.
  
  PR: 2914
  
  Revision  Changes    Path
  1.1042    +6 -1      apache-1.3/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/CHANGES,v
  retrieving revision 1.1041
  retrieving revision 1.1042
  diff -u -r1.1041 -r1.1042
  --- CHANGES	1998/08/31 13:33:50	1.1041
  +++ CHANGES	1998/08/31 19:51:53	1.1042
  @@ -1,5 +1,10 @@
   Changes with Apache 1.3.2
   
  +  *) As duplicate "HTTP/1.0 200 OK" lines within the header seem to be
  +     a common problem of (mis-administrated?) IIS servers, make the apache
  +     proxy immune to these errors (and ignore the duplicates, but log
  +     the fact to error_log). [Martin Kraemer], after the proposal in PR#2914 
  +     
     *) The <IfModule and <IfDefine block starting directives now only
        allow exactly one argument. Previously, the optional negation
        character '!' could be separated by whitespace without a syntax
  @@ -31,7 +36,7 @@
        dump core for replies with invalid headers (e.g., duplicate
        "HTTP/1.0 200 OK" lines). These errors are now logged and the
        core dump is avoided. Also, broken replies are not cached.
  -     [Martin Kraemer]
  +     [Martin Kraemer] PR#2914
   
     *) new `GprofDir' directive when compiled with -DGPROF, where gprof can
        plop gmon.out profile data for each child [Doug MacEachern]
  
  
  
  1.6       +5 -1      apache-1.3/src/include/ap_mmn.h
  
  Index: ap_mmn.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/include/ap_mmn.h,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ap_mmn.h	1998/08/25 09:15:29	1.5
  +++ ap_mmn.h	1998/08/31 19:51:58	1.6
  @@ -172,12 +172,16 @@
    *                        ap_proxy_send_fb() and ap_proxy_cache_error(). 
    *                        Add ap_proxy_send_hdr_line() and ap_proxy_bputs2().
    * 19980825 (1.3.2-dev) - renamed is_HTTP_xxx() macros to ap_is_HTTP_xxx()
  + * 19980825.1           - mod_proxy only (minor change): modified interface of
  + *                        ap_proxy_read_headers() and rdcache() to use a
  + *                        request_rec* instead of pool*
  + *                        (for implementing better error reporting).
    */
   
   #ifndef MODULE_MAGIC_NUMBER_MAJOR
   #define MODULE_MAGIC_NUMBER_MAJOR 19980825
   #endif
  -#define MODULE_MAGIC_NUMBER_MINOR 0                     /* 0...n */
  +#define MODULE_MAGIC_NUMBER_MINOR 1                     /* 0...n */
   #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR	/* backward compat */
   
   /* Useful for testing for features. */
  
  
  
  1.40      +1 -1      apache-1.3/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -r1.39 -r1.40
  --- mod_proxy.h	1998/08/16 20:51:55	1.39
  +++ mod_proxy.h	1998/08/31 19:51:59	1.40
  @@ -292,7 +292,7 @@
   char *ap_proxy_canon_netloc(pool *p, char **const urlp, char **userp,
   			 char **passwordp, char **hostp, int *port);
   const char *ap_proxy_date_canon(pool *p, const char *x);
  -table *ap_proxy_read_headers(pool *p, char *buffer, int size, BUFF *f);
  +table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f);
   long int ap_proxy_send_fb(BUFF *f, request_rec *r, cache_req *c);
   void ap_proxy_send_headers(request_rec *r, const char *respline, table *hdrs);
   int ap_proxy_liststr(const char *list, const char *val);
  
  
  
  1.52      +5 -5      apache-1.3/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.51
  retrieving revision 1.52
  diff -u -r1.51 -r1.52
  --- proxy_cache.c	1998/08/25 09:15:34	1.51
  +++ proxy_cache.c	1998/08/31 19:51:59	1.52
  @@ -535,7 +535,7 @@
    *         0 on failure (bad file or wrong URL)
    *        -1 on UNIX error
    */
  -static int rdcache(pool *p, BUFF *cachefp, cache_req *c)
  +static int rdcache(request_rec *r, BUFF *cachefp, cache_req *c)
   {
       char urlbuff[1034], *strp;
       int len;
  @@ -580,19 +580,19 @@
   	return 0;
       urlbuff[--len] = '\0';
   
  -    c->resp_line = ap_pstrdup(p, urlbuff);
  +    c->resp_line = ap_pstrdup(r->pool, urlbuff);
       strp = strchr(urlbuff, ' ');
       if (strp == NULL)
   	return 0;
   
       c->status = atoi(strp);
  -    c->hdrs = ap_proxy_read_headers(p, urlbuff, sizeof urlbuff, cachefp);
  +    c->hdrs = ap_proxy_read_headers(r, urlbuff, sizeof urlbuff, cachefp);
       if (c->hdrs == NULL)
   	return -1;
       if (c->len != -1) {		/* add a content-length header */
   	if (ap_table_get(c->hdrs, "Content-Length") == NULL) {
   	    ap_table_set(c->hdrs, "Content-Length",
  -			 ap_psprintf(p, "%lu", (unsigned long)c->len));
  +			 ap_psprintf(r->pool, "%lu", (unsigned long)c->len));
   	}
       }
       return 1;
  @@ -677,7 +677,7 @@
       }
   
       if (cachefp != NULL) {
  -	i = rdcache(r->pool, cachefp, c);
  +	i = rdcache(r, cachefp, c);
   	if (i == -1)
   	    ap_log_rerror(APLOG_MARK, APLOG_ERR, r,
   			 "proxy: error reading cache file %s", 
  
  
  
  1.60      +1 -1      apache-1.3/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- proxy_http.c	1998/08/27 16:02:37	1.59
  +++ proxy_http.c	1998/08/31 19:51:59	1.60
  @@ -398,7 +398,7 @@
   /* N.B. for HTTP/1.0 clients, we have to fold line-wrapped headers */
   /* Also, take care with headers with multiple occurences. */
   
  -	resp_hdrs = ap_proxy_read_headers(p, buffer, HUGE_STRING_LEN, f);
  +	resp_hdrs = ap_proxy_read_headers(r, buffer, HUGE_STRING_LEN, f);
   	if (resp_hdrs == NULL) {
   	    ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r->server,
   		 "proxy: Bad HTTP/%d.%d header returned by %s (%s)",
  
  
  
  1.70      +19 -3     apache-1.3/src/modules/proxy/proxy_util.c
  
  Index: proxy_util.c
  ===================================================================
  RCS file: /export/home/cvs/apache-1.3/src/modules/proxy/proxy_util.c,v
  retrieving revision 1.69
  retrieving revision 1.70
  diff -u -r1.69 -r1.70
  --- proxy_util.c	1998/08/16 20:21:28	1.69
  +++ proxy_util.c	1998/08/31 19:51:59	1.70
  @@ -62,6 +62,7 @@
   #include "multithread.h"
   #include "http_log.h"
   #include "util_uri.h"
  +#include "util_date.h"	/* get ap_checkmask() decl. */
   
   static int proxy_match_ipaddr(struct dirconn_entry *This, request_rec *r);
   static int proxy_match_domainname(struct dirconn_entry *This, request_rec *r);
  @@ -424,14 +425,14 @@
    * @@@: XXX: FIXME: currently the headers are passed thru un-merged. 
    * Is that okay, or should they be collapsed where possible?
    */
  -table *ap_proxy_read_headers(pool *p, char *buffer, int size, BUFF *f)
  +table *ap_proxy_read_headers(request_rec *r, char *buffer, int size, BUFF *f)
   {
       table *resp_hdrs;
       int len;
       char *value, *end;
       char field[MAX_STRING_LEN];
   
  -    resp_hdrs = ap_make_table(p, 20);
  +    resp_hdrs = ap_make_table(r->pool, 20);
   
       /*
        * Read header lines until we get the empty separator line, a read error,
  @@ -440,7 +441,22 @@
       while ((len = proxy_getline(buffer, size, f, 1)) > 0) {
   	
   	if (!(value = strchr(buffer, ':'))) {     /* Find the colon separator */
  -	    return NULL;
  +
  +	    /* Buggy MS IIS servers sometimes return invalid headers
  +	     * (an extra "HTTP/1.0 200, OK" line sprinkled in between
  +	     * the usual MIME headers). Try to deal with it in a sensible
  +	     * way, but log the fact.
  +	     * XXX: The mask check is buggy if we ever see an HTTP/1.10 */
  +
  +	    if (!ap_checkmask(buffer, "HTTP/#.# ###*")) {
  +		/* Nope, it wasn't even an extra HTTP header. Give up. */
  +		return NULL;
  +	    }
  +
  +	    ap_log_error(APLOG_MARK, APLOG_WARNING|APLOG_NOERRNO, r->server,
  +			 "proxy: Ignoring duplicate HTTP header "
  +			 "returned by %s (%s)", r->uri, r->method);
  +	    continue;
   	}
   
           *value = '\0';
  
  
  

Re: cvs commit: apache-1.3/src/modules/proxy mod_proxy.h proxy_cache.c proxy_http.c proxy_util.c

Posted by Dean Gaudet <dg...@arctic.org>.

On 31 Aug 1998 martin@hyperreal.org wrote:

>   Log:
>   As per Rick Ohnemus' <ri...@ecompcon.com> suggestion in PR#2914,
>   apache now (logs and) ignores duplicate occurences of
>   "HTTP/1.0 200 OK" lines often generated by IIS servers.

Do we need to start a known_server_problems.html document?  ;)

Dean