You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by Tom Tromey <tr...@creche.cygnus.com> on 1996/09/19 22:19:54 UTC
http/1.0 appendix b ("tolerant applications")
Appendix B ("Tolerant Applications") of the HTTP/1.0 spec says this:
Clients should be tolerant in parsing the Status-Line and servers
tolerant when parsing the Request-Line. In particular, they should
accept any amount of SP or HT characters between fields, even though
only a single SP is required.
My test suite indicates that Apache 1.1.1 does not do this.
Appended is a patch that fixes this behavior. Again, apply over my
previous patches.
Tom
--
tromey@cygnus.com Member, League for Programming Freedom
Index: http_protocol.c
===================================================================
RCS file: /rel/cvsfiles/devo/apache/src/http_protocol.c,v
retrieving revision 1.2
diff -c -5 -r1.2 http_protocol.c
*** http_protocol.c 1996/09/19 18:58:49 1.2
--- http_protocol.c 1996/09/19 20:12:18
***************
*** 338,349 ****
return 0;
if(!l[0])
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);
r->assbackwards = (ll[0] == '\0');
r->protocol = pstrdup (r->pool, ll[0] ? ll : "HTTP/0.9");
--- 340,351 ----
return 0;
if(!l[0])
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);
r->assbackwards = (ll[0] == '\0');
r->protocol = pstrdup (r->pool, ll[0] ? ll : "HTTP/0.9");
Index: httpd.h
===================================================================
RCS file: /rel/cvsfiles/devo/apache/src/httpd.h,v
retrieving revision 1.5
diff -c -5 -r1.5 httpd.h
*** httpd.h 1996/08/26 23:08:33 1.5
--- httpd.h 1996/09/19 20:13:47
***************
*** 510,519 ****
--- 510,520 ----
char *gm_timestr_822(pool *p, time_t t);
/* 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);
char *get_token (pool *p, char **accept_line, int accept_white);
Index: util.c
===================================================================
RCS file: /rel/cvsfiles/devo/apache/src/util.c,v
retrieving revision 1.5
diff -c -5 -r1.5 util.c
*** util.c 1996/08/26 23:08:39 1.5
--- util.c 1996/09/19 20:14:33
***************
*** 317,326 ****
--- 317,355 ----
*line += pos;
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;
if (pos == -1) {