fielding    97/08/15 10:08:58

  Modified:    src      Tag: APACHE_1_2_X CHANGES http_protocol.c
               src/modules/proxy Tag: APACHE_1_2_X mod_proxy.h
                        proxy_cache.c proxy_ftp.c proxy_http.c
  Log:
  Force proxy to always respond as HTTP/1.0, which it was failing to
  do for errors and cached responses.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.286.2.46 +3 -0      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.286.2.45
  retrieving revision 1.286.2.46
  diff -u -r1.286.2.45 -r1.286.2.46
  --- CHANGES   1997/08/12 11:58:58     1.286.2.45
  +++ CHANGES   1997/08/15 17:08:50     1.286.2.46
  @@ -1,6 +1,9 @@
   
   Changes with Apache 1.2.3
   
  +  *) Force proxy to always respond as HTTP/1.0, which it was failing to
  +     do for errors and cached responses.  [Roy Fielding]
  +
   Changes with Apache 1.2.2 [not released]
   
     *) Fixed another long-standing bug in sub_req_lookup_file where it would
  
  
  
  1.126.2.6 +9 -2      apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.126.2.5
  retrieving revision 1.126.2.6
  diff -u -r1.126.2.5 -r1.126.2.6
  --- http_protocol.c   1997/07/31 08:19:48     1.126.2.5
  +++ http_protocol.c   1997/08/15 17:08:51     1.126.2.6
  @@ -1044,9 +1044,16 @@
       if (!r->status_line)
           r->status_line = status_lines[index_of_response(r->status)];
   
  -    if (r->proto_num == 1000
  -     && table_get(r->subprocess_env,"force-response-1.0"))
  +    /* mod_proxy is only HTTP/1.0, so avoid sending HTTP/1.1 error response;
  +     * kluge around broken browsers when indicated by force-response-1.0
  +     */
  +    if (r->proxyreq
  +     || (r->proto_num == 1000
  +         && table_get(r->subprocess_env,"force-response-1.0"))) {
  +
        protocol = "HTTP/1.0";
  +     r->connection->keepalive = -1;
  +    }
       else
        protocol = SERVER_PROTOCOL;
   
  
  
  
  No                   revision
  
  
  No                   revision
  
  
  1.11.2.1  +1 -1      apache/src/modules/proxy/mod_proxy.h
  
  Index: mod_proxy.h
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/mod_proxy.h,v
  retrieving revision 1.11
  retrieving revision 1.11.2.1
  diff -u -r1.11 -r1.11.2.1
  --- mod_proxy.h       1997/04/16 00:13:05     1.11
  +++ mod_proxy.h       1997/08/15 17:08:54     1.11.2.1
  @@ -225,7 +225,7 @@
   int proxy_cache_check(request_rec *r, char *url, struct cache_conf *conf,
       struct cache_req **cr);
   int proxy_cache_update(struct cache_req *c, array_header *resp_hdrs,
  -    const char *protocol, int nocache);
  +    const int is_HTTP1, int nocache);
   void proxy_garbage_coll(request_rec *r);
   
   /* proxy_connect.c */
  
  
  
  1.13.2.1  +2 -3      apache/src/modules/proxy/proxy_cache.c
  
  Index: proxy_cache.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_cache.c,v
  retrieving revision 1.13
  retrieving revision 1.13.2.1
  diff -u -r1.13 -r1.13.2.1
  --- proxy_cache.c     1997/05/29 15:16:01     1.13
  +++ proxy_cache.c     1997/08/15 17:08:55     1.13.2.1
  @@ -581,7 +581,7 @@
    */
   int
   proxy_cache_update(struct cache_req *c, array_header *resp_hdrs,
  -          const char *protocol, int nocache)
  +                   const int is_HTTP1, int nocache)
   {
       request_rec *r=c->req;
       char *p;
  @@ -632,8 +632,7 @@
       if ((r->status != 200 && r->status != 301 && r->status != 304) ||
        (expire != NULL && expc == BAD_DATE) ||
        (r->status == 304 && c->fp == NULL) ||
  -     (r->status == 200 && lmods == NULL &&
  -                          strncmp(protocol, "HTTP/1.", 7) == 0) ||
  +     (r->status == 200 && lmods == NULL && is_HTTP1) ||
        r->header_only ||
        table_get(r->headers_in, "Authorization") != NULL ||
        nocache)
  
  
  
  1.21.2.1  +1 -1      apache/src/modules/proxy/proxy_ftp.c
  
  Index: proxy_ftp.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_ftp.c,v
  retrieving revision 1.21
  retrieving revision 1.21.2.1
  diff -u -r1.21 -r1.21.2.1
  --- proxy_ftp.c       1997/04/22 03:29:37     1.21
  +++ proxy_ftp.c       1997/08/15 17:08:55     1.21.2.1
  @@ -908,7 +908,7 @@
               nocache = 1;
       }
   
  -    i = proxy_cache_update(c, resp_hdrs, "FTP", nocache);
  +    i = proxy_cache_update(c, resp_hdrs, 0, nocache);
   
       if (i != DECLINED)
       {
  
  
  
  1.17.2.2  +12 -14    apache/src/modules/proxy/proxy_http.c
  
  Index: proxy_http.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/modules/proxy/proxy_http.c,v
  retrieving revision 1.17.2.1
  retrieving revision 1.17.2.2
  diff -u -r1.17.2.1 -r1.17.2.2
  --- proxy_http.c      1997/07/20 18:36:03     1.17.2.1
  +++ proxy_http.c      1997/08/15 17:08:56     1.17.2.2
  @@ -143,7 +143,7 @@
   {
       char *p;
       const char *err, *desthost;
  -    int i, j, sock, len;
  +    int i, j, sock, len, backasswards;
       array_header *reqhdrs_arr, *resp_hdrs;
       table_entry *reqhdrs;
       struct sockaddr_in server;
  @@ -151,7 +151,7 @@
       struct hostent server_hp;
       BUFF *f, *cache;
       struct hdr_entry *hdr;
  -    char buffer[HUGE_STRING_LEN], inprotocol[9], outprotocol[9];
  +    char buffer[HUGE_STRING_LEN];
       pool *pool=r->pool;
       const long int zero=0L;
       int destport = 0;
  @@ -286,7 +286,7 @@
        return proxyerror(r, "Error reading from remote server");
       }
   
  -/* Is it an HTTP/1 response? */
  +/* Is it an HTTP/1 response?  This is buggy if we ever see an HTTP/1.10 */
       if (checkmask(buffer,  "HTTP/#.# ###*"))
       {
   /* If not an HTTP/1 messsage or if the status line was > 8192 bytes */
  @@ -296,12 +296,9 @@
            kill_timeout(r);
            return BAD_GATEWAY;
        }
  +     backasswards = 0;
        buffer[--len] = '\0';
  -     memcpy(inprotocol, buffer, 8);
  -     inprotocol[8] = '\0';
   
  -/* we use the same protocol on output as on input */
  -     strcpy(outprotocol, inprotocol);
        buffer[12] = '\0';
        r->status = atoi(&buffer[9]);
        buffer[12] = ' ';
  @@ -312,11 +309,13 @@
   /* Also, take care with headers with multiple occurences. */
   
        resp_hdrs = proxy_read_headers(pool, buffer, HUGE_STRING_LEN, f);
  -    } else
  +
  +     clear_connection((table *)resp_hdrs);  /* Strip Connection hdrs */
  +    }
  +    else
       {
   /* an http/0.9 response */
  -     strcpy(inprotocol, "HTTP/0.9");
  -     strcpy(outprotocol, "HTTP/1.0");
  +     backasswards = 1;
        r->status = 200;
        r->status_line = "200 OK";
   
  @@ -350,7 +349,7 @@
            nocache = 1; 
       }
   
  -    i = proxy_cache_update(c, resp_hdrs, inprotocol, nocache);
  +    i = proxy_cache_update(c, resp_hdrs, !backasswards, nocache);
       if (i != DECLINED)
       {
        pclosef(pool, sock);
  @@ -365,8 +364,7 @@
       if (!r->assbackwards)
           rvputs(r, "HTTP/1.0 ", r->status_line, "\015\012", NULL);
       if (cache != NULL)
  -     if (bvputs(cache, outprotocol, " ", r->status_line, "\015\012", NULL)
  -         == -1)
  +     if (bvputs(cache, "HTTP/1.0 ", r->status_line, "\015\012", NULL) == -1)
            cache = proxy_cache_error(c);
   
   /* send headers */
  @@ -389,7 +387,7 @@
       bsetopt(r->connection->client, BO_BYTECT, &zero);
       r->sent_bodyct = 1;
   /* Is it an HTTP/0.9 respose? If so, send the extra data */
  -    if (strcmp(inprotocol, "HTTP/0.9") == 0)
  +    if (backasswards)
       {
        bwrite(r->connection->client, buffer, len);
        if (cache != NULL)
  
  
  

Reply via email to