Merge pull request #50 from jedisct1/parse-requests-with-hosts-and-empty-path

Accept requests like <method> <protocol>://<host> <http version>
This commit is contained in:
Mark Ellzey 2012-11-26 07:57:19 -08:00
commit 79ec9bd610

View file

@ -762,6 +762,8 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len)
p->port_offset = &p->buf[p->buf_idx];
p->state = s_port;
break;
case ' ':
i--;
case '/':
p->path_offset = &p->buf[p->buf_idx];
@ -770,10 +772,6 @@ htparser_run(htparser * p, htparse_hooks * hooks, const char * data, size_t len)
p->state = s_after_slash_in_uri;
break;
case ' ':
/* p->buf should contain the whole uri */
p->state = s_http_09;
break;
default:
p->error = htparse_error_inval_schema;
return i + 1;