http_parser
Version, currently 0.82 versions
- 0.8latestMay 10, 2016
- 0.7not indexedFeb 27, 2017
github.com/kostya/http_parser.cr
Crystal wrapper for Http Parser lib: https://github.com/joyent/http-parser
17 stars
0 dependents
License: MIT
Installation
# Add this to your shard.yml
dependencies:
http_parser:
github: kostya/http_parser.cr
version: ~> 0.8Then run:
shards installshard.yml
- Crystal
- no constraint declared
- License
- MIT
- Author
- Konstantin Makarchev
Dependencies
This version declares no dependencies.
README
# HttpParser
Crystal wrapper for Http Parser lib: https://github.com/joyent/http-parser. And for Http multipart parser https://github.com/iafonov/multipart-parser-c
## Installation
Add this to your application's `shard.yml`:
```yaml
dependencies:
http_parser:
github: kostya/http_parser.cr
```
## Usage
```crystal
require "http_parser"
puts HttpParser.version_string
str = "
GET / HTTP/1.1
Host: www.example.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.78 S
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
"
parser = HttpParser::Request.new
parser << str
p parser.headers
p parser.method
p parser.http_version
p parser.request_url
```
Multipart Example:
```crystal
str = "--AaB03x\r\n"+
"content-disposition: form-data; name=\"field1\"\r\n"+
"\r\n"+
"Joe Blow\r\nalmost tricked you!\r\n"+
"--AaB03x\r\n"+
"content-disposition: form-data; name=\"pics\"; filename=\"file1.txt\"\r\n"+
"Content-Type: text/plain\r\n"+
"\r\n"+
"... contents of file1.txt ...\r\r\n"+
"--AaB03x--\r\n"
m = HttpParser::Multipart.new("AaB03x")
m << str
p m.parts
```
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.8- Tagged
- May 10, 2016
- Commit
d7565840d1f4- Indexed
- yes
Dependents
No indexed shard depends on this one yet.
Repository
github.com/kostya/http_parser.cr
Metadata
- Created
- Aug 12, 2026
- Updated
- Aug 13, 2026
- Synced
- Aug 13, 2026
- Versions
- 2