httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexei Kosut <ako...@nueva.pvt.k12.ca.us>
Subject HTTP/1.1
Date Sat, 31 Aug 1996 06:06:14 GMT
The IESG has approved HTTP/1.1 as a proposed standard. Whee. So, I'd
like to commit the following patch. It basically just turns on the
HTTP/1.1 label and cleans up persistent connection support a bit.

Thoughts, anyone?

Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.44
diff -c -r1.44 http_protocol.c
*** http_protocol.c	1996/08/24 16:04:54	1.44
--- http_protocol.c	1996/08/31 05:58:21
***************
*** 284,316 ****
  {
      char *conn = table_get (r->headers_in, "Connection");
      char *length = table_get (r->headers_out, "Content-length");
  
      if ((r->server->keep_alive > r->connection->keepalives) &&
  	(r->server->keep_alive_timeout > 0) &&
  	(r->header_only || length ||
  	 ((r->proto_num >= 1001) && (r->byterange > 1 || (r->chunked = 1))))
&&
  	(!find_token(r->pool, conn, "close")) &&
! #ifdef FORHTTP11
! 	((proto_num >= 1001) || find_token(r->pool, conn, "keep-alive"))) {
! #else
! 	(find_token(r->pool, conn, "keep-alive"))) {
! #endif
  	char header[26];
  	int left = r->server->keep_alive - r->connection->keepalives;
  	
  	r->connection->keepalive = 1;
  	r->connection->keepalives++;
  	
! #ifdef FORHTTP11
! 	if (r->proto_num < 1001) {
! #endif
  	    sprintf(header, "timeout=%d, max=%d",
  		    r->server->keep_alive_timeout, left);
! 	    table_merge (r->headers_out, "Connection", "Keep-Alive");
! 	    table_set (r->headers_out, "Keep-Alive", pstrdup(r->pool, header));
! #ifdef FORHTTP11
  	}
- #endif	
  
  	return 1;
      }
--- 284,311 ----
  {
      char *conn = table_get (r->headers_in, "Connection");
      char *length = table_get (r->headers_out, "Content-length");
+     int ka_sent;
  
      if ((r->server->keep_alive > r->connection->keepalives) &&
  	(r->server->keep_alive_timeout > 0) &&
  	(r->header_only || length ||
  	 ((r->proto_num >= 1001) && (r->byterange > 1 || (r->chunked = 1))))
&&
  	(!find_token(r->pool, conn, "close")) &&
! 	((ka_sent = find_token(r->pool, conn, "keep-alive")) ||
! 	 r->proto_num >= 1001)) {
  	char header[26];
  	int left = r->server->keep_alive - r->connection->keepalives;
  	
  	r->connection->keepalive = 1;
  	r->connection->keepalives++;
  	
! 	/* If they sent a Keep-Alive token, send one back */
! 	if (ka_sent) {
  	    sprintf(header, "timeout=%d, max=%d",
  		    r->server->keep_alive_timeout, left);
! 	    rputs("Connection: Keep-Alive\015\012", r);
! 	    rvputs(r, "Keep-Alive: ", header, "\015\012", NULL);
  	}
  
  	return 1;
      }
***************
*** 320,326 ****
       * as HTTP/1.0, but pass our request along with our HTTP/1.1 tag
       * to a HTTP/1.1 client. Better safe than sorry.
       */
!     table_merge (r->headers_out, "Connection", "close");
  
      return 0;
  }
--- 315,321 ----
       * as HTTP/1.0, but pass our request along with our HTTP/1.1 tag
       * to a HTTP/1.1 client. Better safe than sorry.
       */
!     rputs("Connection: close\015\012", r);
  
      return 0;
  }
***************
*** 1274,1293 ****
  	    if (etag) bvputs(c->client, "ETag: ", etag, "\015\012", NULL);
  	    if (cloc) bvputs(c->client, "Content-Location: ", cloc,
  			     "\015\012", NULL);
! 	    if (set_keepalive(r)) {
! #ifdef FORHTTP11
! 		if (r->proto_num < 1001)
! #endif
! 		    bputs("Connection: Keep-Alive\015\012", c->client);
! 	    }
! 	    else bputs("Connection: close\015\012", c->client);
  	    bputs("\015\012", c->client);
  	    return;
  	}
  
! 	/* We don't want persistent connections here, for several reasons.
! 	 * Most importantly, if there's been an error, we don't want
! 	 * it screwing up the next request.
  	 */
  	bputs("Connection: close\015\012", c->client);
  	
--- 1269,1283 ----
  	    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;
  	}
  
! 	/* Someday, we'd like to have persistent connections here.
! 	 * They're especially useful for redirects, multiple choices
! 	 * and auth requests. But we need to rewrite the rest of thi
! 	 * section, so for now, we don't use it.
  	 */
  	bputs("Connection: close\015\012", c->client);
  	
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.48
diff -c -r1.48 httpd.h
*** httpd.h	1996/08/24 16:33:29	1.48
--- httpd.h	1996/08/31 05:58:25
***************
*** 245,251 ****
  
  #define SERVER_VERSION "Apache/1.2-dev" /* SEE COMMENTS ABOVE */
  
! #define SERVER_PROTOCOL "HTTP/1.0"
  #define SERVER_SUPPORT "http://www.apache.org/"
  
  #define DECLINED -1		/* Module declines to handle */
--- 245,251 ----
  
  #define SERVER_VERSION "Apache/1.2-dev" /* SEE COMMENTS ABOVE */
  
! #define SERVER_PROTOCOL "HTTP/1.1"
  #define SERVER_SUPPORT "http://www.apache.org/"
  
  #define DECLINED -1		/* Module declines to handle */


-- 
________________________________________________________________________
Alexei Kosut <akosut@nueva.pvt.k12.ca.us>      The Apache HTTP Server
URL: http://www.nueva.pvt.k12.ca.us/~akosut/   http://www.apache.org/


Mime
View raw message