httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Behlendorf <br...@hyperreal.com>
Subject patch to 1.2 for tom tromey's HTTP compliance patches
Date Mon, 23 Sep 1996 03:49:39 GMT

This patch merges the three patches Tom posted, and has them applied to
the current 1.2 cvs snapshot.  It compiles fine, and I tested each
condition Tom claims to have fixed.  


Index: http_protocol.c
===================================================================
RCS file: /export/home/cvs/apache/src/http_protocol.c,v
retrieving revision 1.46
diff -C3 -r1.46 http_protocol.c
*** http_protocol.c	1996/09/17 14:53:54	1.46
--- http_protocol.c	1996/09/23 03:15:10
***************
*** 327,332 ****
--- 327,333 ----
      char *if_unmodified = table_get (r->headers_in, "If-Unmodified-Since");
      char *if_nonematch = table_get (r->headers_in, "If-None-Match");
      char *if_match = table_get (r->headers_in, "If-Match");
+     time_t server_time = time (NULL);
  
      /* Invalid, future time... just ignore it */
      if (mtime > r->request_time) return OK;
***************
*** 369,375 ****
      if ((r->status < 200) || (r->status >= 300))
          return OK;
  
!     if (if_modified_since && later_than(gmtime(&mtime), if_modified_since))
          return USE_LOCAL_COPY;
      else if (if_unmodified && !later_than(gmtime(&mtime), if_unmodified))
          return PRECONDITION_FAILED;
--- 370,378 ----
      if ((r->status < 200) || (r->status >= 300))
          return OK;
  
!     if (if_modified_since && !r->header_only &&
! 	later_than(gmtime(&mtime), if_modified_since) &&
! 	!later_than(gmtime(&server_time), if_modified_since))
          return USE_LOCAL_COPY;
      else if (if_unmodified && !later_than(gmtime(&mtime), if_unmodified))
          return PRECONDITION_FAILED;
***************
*** 508,515 ****
          return 0;
  
      r->the_request = pstrdup (r->pool, l);
!     r->method = getword(r->pool, &ll,' ');
!     uri = getword(r->pool, &ll,' ');
      uri = check_fulluri(r, uri);
      parse_uri (r, uri);
      
--- 511,518 ----
          return 0;
  
      r->the_request = pstrdup (r->pool, l);
!     r->method = getword_white(r->pool, &ll);
!     uri = getword_white(r->pool, &ll);
      uri = check_fulluri(r, uri);
      parse_uri (r, uri);
      
Index: httpd.h
===================================================================
RCS file: /export/home/cvs/apache/src/httpd.h,v
retrieving revision 1.49
diff -C3 -r1.49 httpd.h
*** httpd.h	1996/09/03 00:31:27	1.49
--- httpd.h	1996/09/23 03:15:39
***************
*** 554,559 ****
--- 554,560 ----
  /* String handling */     
       
  char *getword(pool *p, char **line, char stop);
+ char *getword_white(pool *p, char **line);
  char *getword_nulls (pool *p, char **line, char stop);
  char *getword_conf (pool *p, char **line);      
  
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.18
diff -C3 -r1.18 util.c
*** util.c	1996/08/20 11:51:23	1.18
--- util.c	1996/09/23 03:17:42
***************
*** 395,400 ****
--- 395,429 ----
      
      return res;
  }
+ 
+ char *getword_white(pool* atrans, char **line) {
+     int pos = -1, x;
+     char *res;
+ 
+     for(x=0;(*line)[x];x++) {
+         if (isspace((*line)[x])) {
+           pos=x;
+           break;
+       }
+    }
+ 
+     if (pos == -1) {
+         res = pstrdup (atrans, *line);
+       *line += strlen (*line);
+       return res;
+     }
+ 
+     res = palloc(atrans, pos + 1);
+     strncpy (res, *line, pos);
+     res[pos] = '\0';
+ 
+     while (isspace((*line)[pos])) ++pos;
+ 
+     *line += pos;
+ 
+     return res;
+ }
+ 
  char *getword_nulls(pool* atrans, char **line, char stop) {
      int pos = ind(*line, stop);
      char *res;



Mime
View raw message