httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Roy Fielding <field...@hyperreal.com>
Subject cvs commit: apache/src CHANGES http_protocol.c
Date Thu, 30 Jan 1997 03:17:55 GMT
fielding    97/01/29 19:17:55

  Modified:    src       CHANGES http_protocol.c
  Log:
  Output all HTTP/1.1 header fields on responses, with special care for
  the 304 response.
  
  Submitted by: Paul Sutton
  Reviewed by: Randy Terbush, Roy Fielding
  
  Revision  Changes    Path
  1.142     +5 -2      apache/src/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /export/home/cvs/apache/src/CHANGES,v
  retrieving revision 1.141
  retrieving revision 1.142
  diff -C3 -r1.141 -r1.142
  *** CHANGES	1997/01/30 02:51:44	1.141
  --- CHANGES	1997/01/30 03:17:52	1.142
  ***************
  *** 7,16 ****
         This fixes a problem introduced in 1.2b5 with clients that send
         an extra CRLF after a POST request. [Dean Gaudet]
    
  !   *) Fix mod_rewrite bug which truncated the rewritten URL [Marc Slemko]
    
  !   *) Fix mod_info output corruption bug introduced by buffer overflow
         fixes. [Dean Gaudet]
    
    Changes with Apache 1.2b6
    
  --- 7,19 ----
         This fixes a problem introduced in 1.2b5 with clients that send
         an extra CRLF after a POST request. [Dean Gaudet]
    
  !   *) Fixed mod_rewrite bug which truncated the rewritten URL [Marc Slemko]
    
  !   *) Fixed mod_info output corruption bug introduced by buffer overflow
         fixes. [Dean Gaudet]
  + 
  +   *) Fixed http_protocol to correctly output all HTTP/1.1 headers, including
  +      for the special case of a 304 response.  [Paul Sutton]
    
    Changes with Apache 1.2b6
    
  
  
  
  1.96      +30 -12    apache/src/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /export/home/cvs/apache/src/http_protocol.c,v
  retrieving revision 1.95
  retrieving revision 1.96
  diff -C3 -r1.95 -r1.96
  *** http_protocol.c	1997/01/30 02:42:58	1.95
  --- http_protocol.c	1997/01/30 03:17:53	1.96
  ***************
  *** 1468,1473 ****
  --- 1468,1479 ----
        return bflush(r->connection->client);
    }
    
  + static void send_header(request_rec *r, char *hdr)
  + {
  +     char *val = table_get(r->headers_out, hdr);
  +     if (val) bvputs(r->connection->client, hdr, ": ", val, "\015\012", NULL);
  + }
  + 
    void send_error_response (request_rec *r, int recursive_error)
    {
        conn_rec *c = r->connection;
  ***************
  *** 1480,1499 ****
    	int i;
    	table *err_hdrs_arr = r->err_headers_out;
    	table_entry *err_hdrs = (table_entry *)err_hdrs_arr->elts;
      
            basic_http_header (r);
    	
  ! 	/* For conditional get's which didn't send anything, *don't*
  ! 	 * send a bogus content-type, or any body --- but must still
  ! 	 * terminate header.
    	 */
    	
  ! 	if (status == USE_LOCAL_COPY) {
  ! 	    char *etag = table_get(r->headers_out, "ETag");
  ! 	    char *cloc = table_get(r->headers_out, "Content-Location");
  ! 	    if (etag) bvputs(c->client, "ETag: ", etag, "\015\012", NULL);
  ! 	    if (cloc) bvputs(c->client, "Content-Location: ", cloc,
  ! 			     "\015\012", NULL);
    	    set_keepalive(r);
    	    bputs("\015\012", c->client);
    	    return;
  --- 1486,1520 ----
    	int i;
    	table *err_hdrs_arr = r->err_headers_out;
    	table_entry *err_hdrs = (table_entry *)err_hdrs_arr->elts;
  + 	table *hdrs_arr = r->headers_out;
  + 	table_entry *hdrs = (table_entry *)hdrs_arr->elts;
      
            basic_http_header (r);
    	
  ! 	/* For non-error statuses (2xx and 3xx), send out all the normal
  ! 	 * headers unless it is a 304. Don't send a Location unless its
  ! 	 * a redirect status (3xx).
    	 */
  + 
  + 	if ((is_HTTP_SUCCESS(status) || is_HTTP_REDIRECT(status)) &&
  + 	    status != HTTP_NOT_MODIFIED) {
  + 	    for (i = 0; i < hdrs_arr->nelts; ++i) {
  + 		if (!hdrs[i].key) continue;
  + 		if (!strcasecmp(hdrs[i].key, "Location") &&
  + 		    !is_HTTP_REDIRECT(status))
  + 		    continue;
  + 		bvputs(c->client, hdrs[i].key, ": ", hdrs[i].val,
  + 		       "\015\012", NULL);
  + 	    }
  + 	}
    	
  ! 	if (status == HTTP_NOT_MODIFIED) {
  ! 	    send_header(r, "ETag");
  ! 	    send_header(r, "Content-Location");
  ! 	    send_header(r, "Expires");
  ! 	    send_header(r, "Cache-Control");
  ! 	    send_header(r, "Vary");
  ! 	    send_header(r, "Warning");
    	    set_keepalive(r);
    	    bputs("\015\012", c->client);
    	    return;
  ***************
  *** 1505,1513 ****
    	 * section, so for now, we don't use it.
    	 */
    	bputs("Connection: close\015\012", c->client);
  - 	
  - 	if (location && is_HTTP_REDIRECT(status))
  - 	    bvputs(c->client, "Location: ", location, "\015\012", NULL);
    
    	if ((status == METHOD_NOT_ALLOWED) || (status == NOT_IMPLEMENTED))
    	    bvputs(c->client, "Allow: ", make_allow(r), "\015\012", NULL);
  --- 1526,1531 ----
  
  
  

Mime
View raw message