https://github.com/seriousben/http-parser
HTTP Parser using parser combinators
https://github.com/seriousben/http-parser
golang http http-parser parser-combinators
Last synced: 3 months ago
JSON representation
HTTP Parser using parser combinators
- Host: GitHub
- URL: https://github.com/seriousben/http-parser
- Owner: seriousben
- Created: 2018-03-24T15:51:39.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2018-03-24T15:51:52.000Z (almost 8 years ago)
- Last Synced: 2025-06-09T12:11:23.524Z (8 months ago)
- Topics: golang, http, http-parser, parser-combinators
- Language: Go
- Homepage:
- Size: 83 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# http-parser
HTTP response parser using [parser combinators](https://en.wikipedia.org/wiki/Parser_combinator).
## Parses [RFC2068](https://tools.ietf.org/html/rfc2068) compliant payload
```
HTTP/1.1 200 OK
Date: Mon, 23 May 2005 22:38:34 GMT
Content-Type: text/html; charset=UTF-8
Content-Encoding: UTF-8
Content-Length: 138
Last-Modified: Wed, 08 Jan 2003 23:11:55 GMT
Server: Apache/1.3.3.7 (Unix) (Red-Hat/Linux)
ETag: "3f80f-1b6-3e1cb03b"
Accept-Ranges: bytes
Connection: close
An Example Page
Hello World, this is a very simple HTML document.
```
## Example
```go
b, _ := ioutil.ReadFile("./parser/testdata/simple-http.text")
parsedData, _ := Parse(b)
fmt.Printf("Status Code: %d", parsedData.StatusCode)
```