summaryrefslogtreecommitdiff
path: root/deps/http_parser
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-21 21:39:14 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-11-21 21:39:14 -0800
commitd695486185257533f3ef591654d2ce69dfeff74f (patch)
treecfb6b0795192ce46740e1587f1fe4b7594fa4f39 /deps/http_parser
parentb64791c7e45b09615ea5528e104d059a85b745e6 (diff)
downloadandroid-node-v8-d695486185257533f3ef591654d2ce69dfeff74f.tar.gz
android-node-v8-d695486185257533f3ef591654d2ce69dfeff74f.tar.bz2
android-node-v8-d695486185257533f3ef591654d2ce69dfeff74f.zip
Upgrade http-parser
Diffstat (limited to 'deps/http_parser')
-rw-r--r--deps/http_parser/CONTRIBUTIONS4
-rw-r--r--deps/http_parser/http_parser.c16
-rw-r--r--deps/http_parser/http_parser.h5
-rw-r--r--deps/http_parser/test.c25
4 files changed, 47 insertions, 3 deletions
diff --git a/deps/http_parser/CONTRIBUTIONS b/deps/http_parser/CONTRIBUTIONS
new file mode 100644
index 0000000000..11ba31e4b9
--- /dev/null
+++ b/deps/http_parser/CONTRIBUTIONS
@@ -0,0 +1,4 @@
+Contributors must agree to the Contributor License Agreement before patches
+can be accepted.
+
+http://spreadsheets2.google.com/viewform?hl=en&formkey=dDJXOGUwbzlYaWM4cHN1MERwQS1CSnc6MQ
diff --git a/deps/http_parser/http_parser.c b/deps/http_parser/http_parser.c
index 492ef171fe..5a0972a7df 100644
--- a/deps/http_parser/http_parser.c
+++ b/deps/http_parser/http_parser.c
@@ -93,6 +93,10 @@ static const char *method_strings[] =
, "MKACTIVITY"
, "CHECKOUT"
, "MERGE"
+ , "M-SEARCH"
+ , "NOTIFY"
+ , "SUBSCRIBE"
+ , "UNSUBSCRIBE"
};
@@ -575,12 +579,14 @@ size_t http_parser_execute (http_parser *parser,
case 'G': parser->method = HTTP_GET; break;
case 'H': parser->method = HTTP_HEAD; break;
case 'L': parser->method = HTTP_LOCK; break;
- case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE */ break;
+ case 'M': parser->method = HTTP_MKCOL; /* or MOVE, MKACTIVITY, MERGE, M-SEARCH */ break;
+ case 'N': parser->method = HTTP_NOTIFY; break;
case 'O': parser->method = HTTP_OPTIONS; break;
case 'P': parser->method = HTTP_POST; /* or PROPFIND or PROPPATCH or PUT */ break;
case 'R': parser->method = HTTP_REPORT; break;
+ case 'S': parser->method = HTTP_SUBSCRIBE; break;
case 'T': parser->method = HTTP_TRACE; break;
- case 'U': parser->method = HTTP_UNLOCK; break;
+ case 'U': parser->method = HTTP_UNLOCK; /* or UNSUBSCRIBE */ break;
default: goto error;
}
state = s_req_method;
@@ -608,6 +614,8 @@ size_t http_parser_execute (http_parser *parser,
parser->method = HTTP_MOVE;
} else if (index == 1 && ch == 'E') {
parser->method = HTTP_MERGE;
+ } else if (index == 1 && ch == '-') {
+ parser->method = HTTP_MSEARCH;
} else if (index == 2 && ch == 'A') {
parser->method = HTTP_MKACTIVITY;
}
@@ -615,6 +623,8 @@ size_t http_parser_execute (http_parser *parser,
parser->method = HTTP_PROPFIND; /* or HTTP_PROPPATCH */
} else if (index == 1 && parser->method == HTTP_POST && ch == 'U') {
parser->method = HTTP_PUT;
+ } else if (index == 2 && parser->method == HTTP_UNLOCK && ch == 'S') {
+ parser->method = HTTP_UNSUBSCRIBE;
} else if (index == 4 && parser->method == HTTP_PROPFIND && ch == 'P') {
parser->method = HTTP_PROPPATCH;
} else {
@@ -628,7 +638,7 @@ size_t http_parser_execute (http_parser *parser,
{
if (ch == ' ') break;
- if (ch == '/') {
+ if (ch == '/' || ch == '*') {
MARK(url);
MARK(path);
state = s_req_path;
diff --git a/deps/http_parser/http_parser.h b/deps/http_parser/http_parser.h
index ca7f562094..c03ec05783 100644
--- a/deps/http_parser/http_parser.h
+++ b/deps/http_parser/http_parser.h
@@ -101,6 +101,11 @@ enum http_method
, HTTP_MKACTIVITY
, HTTP_CHECKOUT
, HTTP_MERGE
+ /* upnp */
+ , HTTP_MSEARCH
+ , HTTP_NOTIFY
+ , HTTP_SUBSCRIBE
+ , HTTP_UNSUBSCRIBE
};
diff --git a/deps/http_parser/test.c b/deps/http_parser/test.c
index d1feae0a8b..e5699aab98 100644
--- a/deps/http_parser/test.c
+++ b/deps/http_parser/test.c
@@ -557,6 +557,31 @@ const struct message requests[] =
,.body= ""
}
+#define MSEARCH_REQ 19
+, {.name= "m-search request"
+ ,.type= HTTP_REQUEST
+ ,.raw= "M-SEARCH * HTTP/1.1\r\n"
+ "HOST: 239.255.255.250:1900\r\n"
+ "MAN: \"ssdp:discover\"\r\n"
+ "ST: \"ssdp:all\"\r\n"
+ "\r\n"
+ ,.should_keep_alive= TRUE
+ ,.message_complete_on_eof= FALSE
+ ,.http_major= 1
+ ,.http_minor= 1
+ ,.method= HTTP_MSEARCH
+ ,.query_string= ""
+ ,.fragment= ""
+ ,.request_path= "*"
+ ,.request_url= "*"
+ ,.num_headers= 3
+ ,.headers= { { "HOST", "239.255.255.250:1900" }
+ , { "MAN", "\"ssdp:discover\"" }
+ , { "ST", "\"ssdp:all\"" }
+ }
+ ,.body= ""
+ }
+
, {.name= NULL } /* sentinel */
};