diff options
Diffstat (limited to 'deps/http_parser/contrib/url_parser.c')
-rw-r--r-- | deps/http_parser/contrib/url_parser.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/deps/http_parser/contrib/url_parser.c b/deps/http_parser/contrib/url_parser.c index b1f9c979f..6650b414a 100644 --- a/deps/http_parser/contrib/url_parser.c +++ b/deps/http_parser/contrib/url_parser.c @@ -14,7 +14,7 @@ dump_url (const char *url, const struct http_parser_url *u) continue; } - printf("\tfield_data[%u]: off: %u len: %u part: \"%.*s\n", + printf("\tfield_data[%u]: off: %u, len: %u, part: %.*s\n", i, u->field_data[i].off, u->field_data[i].len, @@ -24,16 +24,18 @@ dump_url (const char *url, const struct http_parser_url *u) } int main(int argc, char ** argv) { + struct http_parser_url u; + int len, connect, result; + if (argc != 3) { printf("Syntax : %s connect|get url\n", argv[0]); return 1; } - struct http_parser_url u; - int len = strlen(argv[2]); - int connect = strcmp("connect", argv[1]) == 0 ? 1 : 0; + len = strlen(argv[2]); + connect = strcmp("connect", argv[1]) == 0 ? 1 : 0; printf("Parsing %s, connect %d\n", argv[2], connect); - int result = http_parser_parse_url(argv[2], len, connect, &u); + result = http_parser_parse_url(argv[2], len, connect, &u); if (result != 0) { printf("Parse error : %d\n", result); return result; |