Permalink
Browse files

[fix] libnet,stdlib: Fixes for http_client parsing problems.

  • Loading branch information...
nrs135 authored and cedricss committed Mar 7, 2012
1 parent b55f000 commit ee4c464abf2a194b5a117ee145f6e4ff94b7c937
Showing with 5 additions and 3 deletions.
  1. +4 −2 libnet/http/request.trx
  2. +1 −1 stdlib/core/web/core/uri.opa
View
@@ -37,14 +37,14 @@ open RequestType
+response : {Requestdef.Value.value Requestdef.RequestHeader.t} <-
/ ResponseLine headers {{ __2 }}
-RequestLine <- Word Space+ ((!EOL !Space . )+ $_) Space+ Word EOL
+RequestLine <- Word Space+ ((!EOL !Space . )+ $_) Space+ AnyWord EOL
{{ { _method = method_of_string __1 ; request_uri = __3 ; http_version = __5 } }}
# We need to accept HTTP/0.9 requests.
RequestLineShort <- Word Space+ Word EOL
{{ { _method = method_of_string __1 ; request_uri = __3 ; http_version = "HTTP/0.9" } }}
-ResponseLine <- Word Space+ ([0-9]+ $_) (Space+ Word)+ EOL
+ResponseLine <- Word Space+ ([0-9]+ $_) (Space+ AnyWord)+ EOL
{{ __1, int_of_string(__3) }}
response_headers <- Header response_headers {{ let k, v = __1 in try ResponseHeader.add (response_header_of_string k) v __2 with (Parsing _) -> __2 }}
@@ -65,6 +65,8 @@ Value <- ((![;,\r\n] . {{ __2 }})+ $_) ([;] Space* ((![,\r\n] . {{__2 }})+ $_) {
Word <- Char+ $_
Char <- !(FullSpace $ / [:] $) . {{ __2 }}
+AnyWord <- AnyChar+ $_
+AnyChar <- !(FullSpace $) . {{ __2 }}
Space <- ' ' / '\t'
FullSpace <- Space / EOL
@@ -268,7 +268,7 @@ UriParser =
query_parser = Rule.parse_list(query_element, parser [&;] -> void)
query =
- parser "?" query=query_parser -> query
+ parser "?" "&"? query=query_parser -> query
fragment = parser
| "#" fragment=chars -> fragment

0 comments on commit ee4c464

Please sign in to comment.