httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@hyperreal.org
Subject cvs commit: apachen/src/modules/standard mod_negotiation.c
Date Tue, 21 Oct 1997 15:46:25 GMT
martin      97/10/21 08:46:25

  Modified:    src/main http_protocol.c http_request.c httpd.h
  Log:
  Encapsulatte internal representation of HTTP protocol number with a
  HTTP_VERSION(major,minor) macro. Currently, this is backward compatible
  to the algorithm used now (1000*major+minor
  Reviewed by:	Ken +1, Alexei +1, Jim +1
  
  Revision  Changes    Path
  1.167     +9 -6      apachen/src/main/http_protocol.c
  
  Index: http_protocol.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/http_protocol.c,v
  retrieving revision 1.166
  retrieving revision 1.167
  diff -u -r1.166 -r1.167
  --- http_protocol.c	1997/10/07 19:34:03	1.166
  +++ http_protocol.c	1997/10/21 15:40:13	1.167
  @@ -300,7 +300,7 @@
            find_last_token(r->pool,
                            table_get(r->headers_out, "Transfer-Encoding"),
                            "chunked") ||
  -         ((r->proto_num >= 1001) && (r->chunked = 1))) &&
  +         ((r->proto_num >= HTTP_VERSION(1,1)) && (r->chunked = 1))) &&
           r->server->keep_alive &&
           (r->server->keep_alive_timeout > 0) &&
           ((r->server->keep_alive_max == 0) ||
  @@ -311,7 +311,7 @@
           (!table_get(r->subprocess_env, "nokeepalive") ||
            table_get(r->headers_in, "Via")) &&
           ((ka_sent = find_token(r->pool, conn, "keep-alive")) ||
  -         (r->proto_num >= 1001))
  +         (r->proto_num >= HTTP_VERSION(1,1)))
          ) {
           char header[256];
           int left = r->server->keep_alive_max - r->connection->keepalives;
  @@ -726,8 +726,11 @@
   
       r->assbackwards = (ll[0] == '\0');
       r->protocol = pstrdup(r->pool, ll[0] ? ll : "HTTP/0.9");
  -    sscanf(r->protocol, "HTTP/%d.%d", &major, &minor);
  -    r->proto_num = 1000 * major + minor;
  +    if (2 == sscanf(r->protocol, "HTTP/%u.%u", &major, &minor)
  +      && minor < HTTP_VERSION(1,0))	/* don't allow HTTP/0.1000 */
  +	r->proto_num = HTTP_VERSION(major, minor);
  +    else
  +	r->proto_num = HTTP_VERSION(1,0);
   
       return 1;
   }
  @@ -1058,7 +1061,7 @@
        * kluge around broken browsers when indicated by force-response-1.0
        */
       if (r->proxyreq
  -        || (r->proto_num == 1000
  +        || (r->proto_num == HTTP_VERSION(1,0)
               && table_get(r->subprocess_env, "force-response-1.0"))) {
   
           protocol = "HTTP/1.0";
  @@ -1385,7 +1388,7 @@
       if (!r->read_chunked && (r->remaining <= 0))
           return 0;
   
  -    if (r->proto_num >= 1001) { /* sending 100 Continue interim response */
  +    if (r->proto_num >= HTTP_VERSION(1,1)) { /* sending 100 Continue interim response
*/
           bvputs(r->connection->client,
                  SERVER_PROTOCOL, " ", status_lines[0], "\015\012\015\012",
                  NULL);
  
  
  
  1.90      +4 -4      apachen/src/main/http_request.c
  
  Index: http_request.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/http_request.c,v
  retrieving revision 1.89
  retrieving revision 1.90
  diff -u -r1.89 -r1.90
  --- http_request.c	1997/10/15 00:15:13	1.89
  +++ http_request.c	1997/10/21 15:40:14	1.90
  @@ -982,8 +982,8 @@
           return;
       }
   
  -    if ((!r->hostname && (r->proto_num >= 1001)) ||
  -        ((r->proto_num == 1001) && !table_get(r->headers_in, "Host"))) {
  +    if ((!r->hostname && (r->proto_num >= HTTP_VERSION(1,1))) ||
  +        ((r->proto_num == HTTP_VERSION(1,1)) && !table_get(r->headers_in,
"Host"))) {
           /*
            * Client sent us a HTTP/1.1 or later request without telling us the
            * hostname, either with a full URL or a Host: header. We therefore
  @@ -1027,8 +1027,8 @@
           return;
       }
   
  -    if (r->proto_num > 1000 && table_get(r->subprocess_env, "downgrade-1.0"))
{
  -        r->proto_num = 1000;
  +    if (r->proto_num > HTTP_VERSION(1,0) && table_get(r->subprocess_env,
"downgrade-1.0")) {
  +        r->proto_num = HTTP_VERSION(1,0);
       }
   
       /*
  
  
  
  1.161     +5 -0      apachen/src/main/httpd.h
  
  Index: httpd.h
  ===================================================================
  RCS file: /home/cvs/apachen/src/main/httpd.h,v
  retrieving revision 1.160
  retrieving revision 1.161
  diff -u -r1.160 -r1.161
  --- httpd.h	1997/10/17 13:37:28	1.160
  +++ httpd.h	1997/10/21 15:40:15	1.161
  @@ -104,6 +104,11 @@
    */
   
   
  +/* -- Internal representation for a HTTP protocol number, e.g., HTTP/1.1 -- */
  +
  +#define HTTP_VERSION(major,minor) (1000*(major)+(minor))
  +
  +
   /* -------------- Port number for server running standalone --------------- */
   
   #define DEFAULT_PORT 80
  
  
  

  Modified:    src/modules/standard mod_negotiation.c
  Log:
  Encapsulate internal representation of HTTP protocol number with a HTTP_VERSION(major,minor)
macro.
  Currently, this is backward compatible to the algorithm used now (1000*major+minor
  Reviewed by: Ken +1, Alexei +1, Jim +1
  
  Revision  Changes    Path
  1.60      +2 -2      apachen/src/modules/standard/mod_negotiation.c
  
  Index: mod_negotiation.c
  ===================================================================
  RCS file: /home/cvs/apachen/src/modules/standard/mod_negotiation.c,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- mod_negotiation.c	1997/10/17 19:26:56	1.59
  +++ mod_negotiation.c	1997/10/21 15:46:24	1.60
  @@ -2064,7 +2064,7 @@
        * HTTP/1.0, we can't allow caching at all. NB that we merge the
        * header in case some other module negotiates on something else.
        */
  -    if (!do_cache_negotiated_docs(r->server) && (r->proto_num < 1001))
{
  +    if (!do_cache_negotiated_docs(r->server) && (r->proto_num < HTTP_VERSION(1,1)))
{
           r->no_cache = 1;
       }
   
  @@ -2170,7 +2170,7 @@
   
       /* Otherwise, use it. */
   
  -    if ((!do_cache_negotiated_docs(r->server) && (r->proto_num < 1001))
  +    if ((!do_cache_negotiated_docs(r->server) && (r->proto_num < HTTP_VERSION(1,1)))
           && neg->count_multiviews_variants != 1) {
           r->no_cache = 1;
       }
  
  
  

Mime
View raw message