Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 27 lines (23 sloc) 1.295 kb
2ae447a2 »
2010-05-11 add simple benchmark
1 #include <assert.h>
2 #include <stdio.h>
3 #include "picohttpparser.h"
4
5 #define REQ "GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1\r\nHost: www.kittyhell.com\r\nUser-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; ja-JP-mac; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Pathtraq/0.9\r\nAccept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\nAccept-Language: ja,en-us;q=0.7,en;q=0.3\r\nAccept-Encoding: gzip,deflate\r\nAccept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7\r\nKeep-Alive: 115\r\nConnection: keep-alive\r\nCookie: wp_ozh_wsa_visits=2; wp_ozh_wsa_visit_lasttime=xxxxxxxxxx; __utma=xxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.xxxxxxxxxx.x; __utmz=xxxxxxxxx.xxxxxxxxxx.x.x.utmccn=(referral)|utmcsr=reader.livedoor.com|utmcct=/reader/|utmcmd=referral\r\n\r\n"
6
7 int main(void)
8 {
9 const char* method;
10 size_t method_len;
11 const char* path;
12 size_t path_len;
13 int minor_version;
14 struct phr_header headers[32];
15 size_t num_headers;
16 int i, ret;
17
18 for (i = 0; i < 1000000; i++) {
19 num_headers = sizeof(headers) / sizeof(headers[0]);
20 ret = phr_parse_request(REQ, sizeof(REQ) - 1, &method, &method_len, &path,
21 &path_len, &minor_version, headers, &num_headers,
22 0);
23 assert(ret == sizeof(REQ) - 1);
24 }
25
26 return 0;
27 }
Something went wrong with that request. Please try again.