Repository: pest-parser/pest (language: rust)

Issue:
Add an HTTP parser to parser_benchmarks
Hello!

I spent some time cleaning up the old nom_benchmarks repository in a more general [parser_benchmarks](https://github.com/Geal/parser_benchmarks). Since we're reaching the point where the various parser libraries reach the same performance, it's getting interesting to have a good way to compare them on the same tests, and transfer techniques from one to the next.

I have added your JSON example and put it to work on the other example files (and added the `canada.json` file you use for your benchmarks): https://github.com/Geal/parser_benchmarks/tree/master/json

Interestingly, I have not been able to make the nom parser faster than the pest one for that file :)

Could you check the benchmark to see if I have not missed anything in how to use pest?
Also, do you think you could contribute a HTTP parser to the repository?


Discussion / hints:
Nice work with the benchmark and thank you for taking the time to do this. 😄 

Everything looks good. You might also want to compare pest against the master branch since there are some performance improvements coming up in the next version.

Regarding the HTTP benchmark, this would have a lower priority for now. We're currently working a lot on improving the developer experience and the docs which is quite harder than I first thought.

EDIT: I've checked the other benchmarks. Congrats on the performance gains!

Fix patch:
diff --git a/FUZZING.md b/FUZZING.md
index a8f7ee1d..e7d895e7 100644
--- a/FUZZING.md
+++ b/FUZZING.md
@@ -21,11 +21,12 @@ There is a single fuzzing target for this crate that interacts with
 
 ### `pest_grammars`
 
+- `http`
 - `toml`
 - `json`
 
-There are two fuzzing targets for this crate: one tests the json grammar in the
-`json` module and the other tests the toml grammar in the `toml` module. They
+There are three fuzzing targets for this crate: one tests the http request grammar in the `http` module, one tests the json grammar in the
+`json` module and the last one tests the toml grammar in the `toml` module. They
 interact directly with the `pest::Parser::parse` function provided by derived
 on the respective Parsers in each module.
 
diff --git a/grammars/Cargo.toml b/grammars/Cargo.toml
index 19943680..72305164 100644
--- a/grammars/Cargo.toml
+++ b/grammars/Cargo.toml
@@ -22,4 +22,8 @@ criterion = "0.3"
 
 [[bench]]
 name = "json"
+harness = false
+
+[[bench]]
+name = "http"
 harness = false
\ No newline at end of file
diff --git a/grammars/benches/http.rs b/grammars/benches/http.rs
new file mode 100644
index 00000000..f3233243
--- /dev/null
+++ b/grammars/benches/http.rs
@@ -0,0 +1,22 @@
+use criterion::{criterion_group, criterion_main, Criterion};
+
+use std::fs::File;
+use std::io::Read;
+
+use pest::Parser;
+
+use pest_grammars::http::*;
+
+fn criterion_benchmark(c: &mut Criterion) {
+    let mut file = File::open("benches/requests.http").unwrap();
+    let mut data = String::new();
+
+    file.read_to_string(&mut data).unwrap();
+
+    c.bench_function("http parser", |b| {
+        b.iter(|| HttpParser::parse(Rule::http, &data).unwrap())
+    });
+}
+
+criterion_group!(benches, criterion_benchmark,);
+criterion_main!(benches);
diff --git a/grammars/benches/requests.http b/grammars/benches/requests.http
new file mode 100644
index 00000000..40684603
--- /dev/null
+++ b/grammars/benches/requests.http
@@ -0,0 +1,494 @@
+GET / HTTP/1.1
+Host: www.reddit.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+
+GET /reddit.v_EZwRzV-Ns.css HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/css,*/*;q=0.1
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /reddit-init.en-us.O1zuMqOOQvY.js HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /reddit.en-us.31yAfSoTsfo.js HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /kill.png HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /icon.png HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+
+GET /favicon.ico HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+
+GET /AMZM4CWd6zstSC8y.jpg HTTP/1.1
+Host: b.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /jz1d5Nm0w97-YyNm.jpg HTTP/1.1
+Host: b.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /aWGO99I6yOcNUKXB.jpg HTTP/1.1
+Host: a.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /rZ_rD5TjrJM0E9Aj.css HTTP/1.1
+Host: e.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/css,*/*;q=0.1
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /tmsPwagFzyTvrGRx.jpg HTTP/1.1
+Host: a.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /KYgUaLvXCK3TCEJx.jpg HTTP/1.1
+Host: a.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /81pzxT5x2ozuEaxX.jpg HTTP/1.1
+Host: e.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /MFqCUiUVPO5V8t6x.jpg HTTP/1.1
+Host: a.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /TFpYTiAO5aEowokv.jpg HTTP/1.1
+Host: e.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /eMWMpmm9APNeNqcF.jpg HTTP/1.1
+Host: e.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /S-IpsJrOKuaK9GZ8.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /3V6dj9PDsNnheDXn.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /wQ3-VmNXhv8sg4SJ.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /ixd1C1njpczEWC22.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /nGsQj15VyOHMwmq8.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /zT4yQmDxQLbIxK1b.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /L5e1HcZLv1iu4nrG.jpg HTTP/1.1
+Host: f.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /WJFFPxD8X4JO_lIG.jpg HTTP/1.1
+Host: f.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /hVMVTDdjuY3bQox5.jpg HTTP/1.1
+Host: f.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /rnWf8CjBcyPQs5y_.jpg HTTP/1.1
+Host: f.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /gZJL1jNylKbGV4d-.jpg HTTP/1.1
+Host: d.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /aNd2zNRLXiMnKUFh.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /droparrowgray.gif HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.redditstatic.com/reddit.v_EZwRzV-Ns.css
+
+GET /sprite-reddit.an0Lnf61Ap4.png HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.redditstatic.com/reddit.v_EZwRzV-Ns.css
+
+GET /ga.js HTTP/1.1
+Host: www.google-analytics.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+If-Modified-Since: Tue, 29 Oct 2013 19:33:51 GMT
+
+GET /reddit/ads.html?sr=-reddit.com&bust2 HTTP/1.1
+Host: static.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /pixel/of_destiny.png?v=hOlmDALJCWWdjzfBV4ZxJPmrdCLWB%2Ftq7Z%2Ffp4Q%2FxXbVPPREuMJMVGzKraTuhhNWxCCwi6yFEZg%3D&r=783333388 HTTP/1.1
+Host: pixel.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /UNcO-h_QcS9PD-Gn.jpg HTTP/1.1
+Host: c.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://e.thumbs.redditmedia.com/rZ_rD5TjrJM0E9Aj.css
+
+GET /welcome-lines.png HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.redditstatic.com/reddit.v_EZwRzV-Ns.css
+
+GET /welcome-upvote.png HTTP/1.1
+Host: www.redditstatic.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.redditstatic.com/reddit.v_EZwRzV-Ns.css
+
+GET /__utm.gif?utmwv=5.5.1&utms=1&utmn=720496082&utmhn=www.reddit.com&utme=8(site*srpath*usertype*uitype)9(%20reddit.com*%20reddit.com-GET_listing*guest*web)11(3!2)&utmcs=UTF-8&utmsr=2560x1600&utmvp=1288x792&utmsc=24-bit&utmul=en-us&utmje=1&utmfl=13.0%20r0&utmdt=reddit%3A%20the%20front%20page%20of%20the%20internet&utmhid=2129416330&utmr=-&utmp=%2F&utmht=1400862512705&utmac=UA-12131688-1&utmcc=__utma%3D55650728.585571751.1400862513.1400862513.1400862513.1%3B%2B__utmz%3D55650728.1400862513.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=qR~ HTTP/1.1
+Host: www.google-analytics.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /ImnpOQhbXUPkwceN.png HTTP/1.1
+Host: a.thumbs.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /ajax/libs/jquery/1.7.1/jquery.min.js HTTP/1.1
+Host: ajax.googleapis.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /__utm.gif?utmwv=5.5.1&utms=2&utmn=1493472678&utmhn=www.reddit.com&utmt=event&utme=5(AdBlock*enabled*false)(0)8(site*srpath*usertype*uitype)9(%20reddit.com*%20reddit.com-GET_listing*guest*web)11(3!2)&utmcs=UTF-8&utmsr=2560x1600&utmvp=1288x792&utmsc=24-bit&utmul=en-us&utmje=1&utmfl=13.0%20r0&utmdt=reddit%3A%20the%20front%20page%20of%20the%20internet&utmhid=2129416330&utmr=-&utmp=%2F&utmht=1400862512708&utmac=UA-12131688-1&utmni=1&utmcc=__utma%3D55650728.585571751.1400862513.1400862513.1400862513.1%3B%2B__utmz%3D55650728.1400862513.1.1.utmcsr%3D(direct)%7Cutmccn%3D(direct)%7Cutmcmd%3D(none)%3B&utmu=6R~ HTTP/1.1
+Host: www.google-analytics.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /ados.js?q=43 HTTP/1.1
+Host: secure.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /fetch-trackers?callback=jQuery111005268222517967478_1400862512407&ids%5B%5D=t3_25jzeq-t8_k2ii&_=1400862512408 HTTP/1.1
+Host: tracker.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /ados?t=1400862512892&request={%22Placements%22:[{%22A%22:5146,%22S%22:24950,%22D%22:%22main%22,%22AT%22:5},{%22A%22:5146,%22S%22:24950,%22D%22:%22sponsorship%22,%22AT%22:8}],%22Keywords%22:%22-reddit.com%22,%22Referrer%22:%22http%3A%2F%2Fwww.reddit.com%2F%22,%22IsAsync%22:true,%22WriteResults%22:true} HTTP/1.1
+Host: engine.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /pixel/of_doom.png?id=t3_25jzeq-t8_k2ii&hash=da31d967485cdbd459ce1e9a5dde279fef7fc381&r=1738649500 HTTP/1.1
+Host: pixel.redditmedia.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /Extensions/adFeedback.js HTTP/1.1
+Host: static.adzrk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: */*
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /Extensions/adFeedback.css HTTP/1.1
+Host: static.adzrk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/css,*/*;q=0.1
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /reddit/ads-load.html?bust2 HTTP/1.1
+Host: static.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://www.reddit.com/
+
+GET /Advertisers/a774d7d6148046efa89403a8db635a81.jpg HTTP/1.1
+Host: static.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /i.gif?e=eyJhdiI6NjIzNTcsImF0Ijo1LCJjbSI6MTE2MzUxLCJjaCI6Nzk4NCwiY3IiOjMzNzAxNSwiZGkiOiI4NmI2Y2UzYWM5NDM0MjhkOTk2ZTg4MjYwZDE5ZTE1YyIsImRtIjoxLCJmYyI6NDE2MTI4LCJmbCI6MjEwNDY0LCJrdyI6Ii1yZWRkaXQuY29tIiwibWsiOiItcmVkZGl0LmNvbSIsIm53Ijo1MTQ2LCJwYyI6MCwicHIiOjIwMzYyLCJydCI6MSwicmYiOiJodHRwOi8vd3d3LnJlZGRpdC5jb20vIiwic3QiOjI0OTUwLCJ1ayI6InVlMS01ZWIwOGFlZWQ5YTc0MDFjOTE5NWNiOTMzZWI3Yzk2NiIsInRzIjoxNDAwODYyNTkzNjQ1fQ&s=lwlbFf2Uywt7zVBFRj_qXXu7msY HTTP/1.1
+Host: engine.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+Cookie: azk=ue1-5eb08aeed9a7401c9195cb933eb7c966
+
+GET /BurstingPipe/adServer.bs?cn=tf&c=19&mc=imp&pli=9994987&PluID=0&ord=1400862593644&rtu=-1 HTTP/1.1
+Host: bs.serving-sys.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads.html?sr=-reddit.com&bust2
+
+GET /Advertisers/63cfd0044ffd49c0a71a6626f7a1d8f0.jpg HTTP/1.1
+Host: static.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads-load.html?bust2
+
+GET /BurstingPipe/adServer.bs?cn=tf&c=19&mc=imp&pli=9962555&PluID=0&ord=1400862593645&rtu=-1 HTTP/1.1
+Host: bs.serving-sys.com
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads-load.html?bust2
+Cookie: S_9994987=6754579095859875029; A4=01fmFvgRnI09SF00000; u2=d1263d39-874b-4a89-86cd-a2ab0860ed4e3Zl040
+
+GET /i.gif?e=eyJhdiI6NjIzNTcsImF0Ijo4LCJjbSI6MTE2MzUxLCJjaCI6Nzk4NCwiY3IiOjMzNzAxOCwiZGkiOiI3OTdlZjU3OWQ5NjE0ODdiODYyMGMyMGJkOTE4YzNiMSIsImRtIjoxLCJmYyI6NDE2MTMxLCJmbCI6MjEwNDY0LCJrdyI6Ii1yZWRkaXQuY29tIiwibWsiOiItcmVkZGl0LmNvbSIsIm53Ijo1MTQ2LCJwYyI6MCwicHIiOjIwMzYyLCJydCI6MSwicmYiOiJodHRwOi8vd3d3LnJlZGRpdC5jb20vIiwic3QiOjI0OTUwLCJ1ayI6InVlMS01ZWIwOGFlZWQ5YTc0MDFjOTE5NWNiOTMzZWI3Yzk2NiIsInRzIjoxNDAwODYyNTkzNjQ2fQ&s=OjzxzXAgQksbdQOHNm-bjZcnZPA HTTP/1.1
+Host: engine.adzerk.net
+User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:15.0) Gecko/20100101 Firefox/15.0.1
+Accept: image/png,image/*;q=0.8,*/*;q=0.5
+Accept-Language: en-us,en;q=0.5
+Accept-Encoding: gzip, deflate
+Connection: keep-alive
+Referer: http://static.adzerk.net/reddit/ads-load.html?bust2
+Cookie: azk=ue1-5eb08aeed9a7401c9195cb933eb7c966
+
+GET /subscribe?host_int=1042356184&ns_map=571794054_374233948806,464381511_13349283399&user_id=245722467&nid=1399334269710011966&ts=1400862514 HTTP/1.1
+Host: notify8.dropbox.com
+Accept-Encoding: identity
+Connection: keep-alive
+X-Dropbox-Locale: en_US
+User-Agent: DropboxDesktopClient/2.7.54 (Macintosh; 10.8; ('i32',); en_US)
+
diff --git a/grammars/fuzz/Cargo.toml b/grammars/fuzz/Cargo.toml
index 6974aa6f..b4234c51 100644
--- a/grammars/fuzz/Cargo.toml
+++ b/grammars/fuzz/Cargo.toml
@@ -19,6 +19,10 @@ git = "https://github.com/rust-fuzz/libfuzzer-sys.git"
 [workspace]
 members = ["."]
 
+[[bin]]
+name = "http"
+path = "fuzz_targets/http.rs"
+
 [[bin]]
 name = "json"
 path = "fuzz_targets/json.rs"
diff --git a/grammars/fuzz/fuzz_targets/http.rs b/grammars/fuzz/fuzz_targets/http.rs
new file mode 100644
index 00000000..388e1973
--- /dev/null
+++ b/grammars/fuzz/fuzz_targets/http.rs
@@ -0,0 +1,14 @@
+#![no_main]
+#[macro_use]
+extern crate libfuzzer_sys;
+extern crate pest;
+extern crate pest_grammars;
+
+fuzz_target!(|data: &[u8]| {
+    use pest_grammars::http;
+    use pest_grammars::Parser;
+
+    if let Ok(s) = std::str::from_utf8(data) {
+        let _ = http::HttpParser::parse(http::Rule::http, s);
+    }
+});
diff --git a/grammars/src/grammars/http.pest b/grammars/src/grammars/http.pest
new file mode 100644
index 00000000..623c937b
--- /dev/null
+++ b/grammars/src/grammars/http.pest
@@ -0,0 +1,20 @@
+http = { SOI ~ (delimiter | request)* ~ EOI}
+
+request = {	
+	request_line ~
+    headers? ~
+    NEWLINE
+}
+
+request_line = _{ method ~ " "+ ~ uri ~ " "+ ~ "HTTP/" ~ version ~ NEWLINE }
+uri = { (!whitespace ~ ANY)+ }
+method = { ("GET" | "DELETE" | "POST" | "PUT") }
+version = { (ASCII_DIGIT | ".")+ }
+whitespace = _{ " " | "\t" }
+
+headers = { header+ }
+header = { header_name ~ ":" ~ whitespace ~ header_value ~ NEWLINE }
+header_name = { (!(NEWLINE | ":") ~ ANY)+ }
+header_value = { (!NEWLINE ~ ANY)+ }
+
+delimiter = { NEWLINE+ }
\ No newline at end of file
diff --git a/grammars/src/lib.rs b/grammars/src/lib.rs
index 6c6285ad..1aafb561 100644
--- a/grammars/src/lib.rs
+++ b/grammars/src/lib.rs
@@ -19,6 +19,13 @@ extern crate pest_derive;
 
 pub use pest::Parser;
 
+pub mod http {
+    /// HTTP parser.
+    #[derive(Parser)]
+    #[grammar = "grammars/http.pest"]
+    pub struct HttpParser;
+}
+
 pub mod json {
     /// JSON parser.
     #[derive(Parser)]


Test patch:
diff --git a/grammars/tests/examples.http b/grammars/tests/examples.http
new file mode 100644
index 00000000..f6490246
--- /dev/null
+++ b/grammars/tests/examples.http
@@ -0,0 +1,11 @@
+GET /wp-content/uploads/2010/03/hello-kitty-darth-vader-pink.jpg HTTP/1.1
+Host: www.kittyhell.com
+User-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
+Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
+Accept-Language: ja,en-us;q=0.7,en;q=0.3
+Accept-Encoding: gzip,deflate
+Accept-Charset: Shift_JIS,utf-8;q=0.7,*;q=0.7
+Keep-Alive: 115
+Connection: keep-alive
+Cookie: 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=referralr
+
diff --git a/grammars/tests/http.rs b/grammars/tests/http.rs
new file mode 100644
index 00000000..241f01ea
--- /dev/null
+++ b/grammars/tests/http.rs
@@ -0,0 +1,60 @@
+#[macro_use]
+extern crate pest;
+use pest_grammars::{http::*, Parser};
+
+#[test]
+fn method() {
+    parses_to! {
+        parser: HttpParser,
+        input: "GET",
+        rule: Rule::method,
+        tokens: [
+            method(0, 3)
+        ]
+    };
+}
+
+#[test]
+fn uri() {
+    parses_to! {
+        parser: HttpParser,
+        input: "/",
+        rule: Rule::uri,
+        tokens: [
+            uri(0, 1)
+        ]
+    };
+}
+
+#[test]
+fn version() {
+    parses_to! {
+        parser: HttpParser,
+        input: "1.1",
+        rule: Rule::version,
+        tokens: [
+            version(0, 3)
+        ]
+    };
+}
+
+#[test]
+fn header() {
+    parses_to! {
+        parser: HttpParser,
+        input: "Connection: keep-alive\n",
+        rule: Rule::header,
+        tokens: [
+            header(0, 23, [
+                header_name(0, 10),
+                header_value(12, 22),
+            ])
+        ]
+    };
+}
+
+#[test]
+fn examples() {
+    let data = include_str!(concat!(env!("CARGO_MANIFEST_DIR"), "/tests/examples.http"));
+    assert!(HttpParser::parse(Rule::http, data).is_ok());
+}