brian 96/09/29 22:56:29
Modified: src http_protocol.c httpd.h util.c Log: Reviewed by: Roy Fielding, Brian Behlendorf Submitted by: Tom Tromey HTTP/1.0 compliance. Revision Changes Path 1.51 +5 -7 apache/src/http_protocol.c Index: http_protocol.c =================================================================== RCS file: /export/home/cvs/apache/src/http_protocol.c,v retrieving revision 1.50 retrieving revision 1.51 diff -C3 -r1.50 -r1.51 *** http_protocol.c 1996/09/28 02:42:46 1.50 --- http_protocol.c 1996/09/30 05:56:25 1.51 *************** *** 50,56 **** * */ ! /* $Id: http_protocol.c,v 1.50 1996/09/28 02:42:46 brian Exp $ */ /* * http_protocol.c --- routines which directly communicate with the --- 50,56 ---- * */ ! /* $Id: http_protocol.c,v 1.51 1996/09/30 05:56:25 brian Exp $ */ /* * http_protocol.c --- routines which directly communicate with the *************** *** 328,336 **** char *if_nonematch = table_get (r->headers_in, "If-None-Match"); char *if_match = table_get (r->headers_in, "If-Match"); - /* Invalid, future time... just ignore it */ - if (mtime > r->request_time) return OK; - ts = gm_timestr_822(r->pool, (mtime > r->request_time) ? r->request_time : mtime); table_set (r->headers_out, "Last-Modified", ts); --- 328,333 ---- *************** *** 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; --- 366,373 ---- if ((r->status < 200) || (r->status >= 300)) return OK; ! if (if_modified_since && !r->header_only && ! later_than(gmtime(&mtime), 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); --- 506,513 ---- 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); 1.51 +2 -1 apache/src/httpd.h Index: httpd.h =================================================================== RCS file: /export/home/cvs/apache/src/httpd.h,v retrieving revision 1.50 retrieving revision 1.51 diff -C3 -r1.50 -r1.51 *** httpd.h 1996/09/24 12:44:58 1.50 --- httpd.h 1996/09/30 05:56:26 1.51 *************** *** 50,56 **** * */ ! /* $Id: httpd.h,v 1.50 1996/09/24 12:44:58 mjc Exp $ */ /* * httpd.h: header for simple (ha! not anymore) http daemon --- 50,56 ---- * */ ! /* $Id: httpd.h,v 1.51 1996/09/30 05:56:26 brian Exp $ */ /* * httpd.h: header for simple (ha! not anymore) http daemon *************** *** 556,561 **** --- 556,562 ---- /* 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); 1.21 +29 -0 apache/src/util.c Index: util.c =================================================================== RCS file: /export/home/cvs/apache/src/util.c,v retrieving revision 1.20 retrieving revision 1.21 diff -C3 -r1.20 -r1.21 *** util.c 1996/09/26 04:16:06 1.20 --- util.c 1996/09/30 05:56:27 1.21 *************** *** 50,56 **** * */ ! /* $Id: util.c,v 1.20 1996/09/26 04:16:06 brian Exp $ */ /* * str.c: string utility things --- 50,56 ---- * */ ! /* $Id: util.c,v 1.21 1996/09/30 05:56:27 brian Exp $ */ /* * str.c: string utility things *************** *** 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;