All Projects → gobwas → httphead

gobwas / httphead

Licence: MIT License
No description or website provided.

Programming Languages

go
31211 projects - #10 most used programming language

Projects that are alternatives of or similar to httphead

dataconf
Simple dataclasses configuration management for Python with hocon/json/yaml/properties/env-vars/dict support.
Stars: ✭ 40 (-44.44%)
Mutual labels:  parsing
GitHub-WebHook
🐱 Validates and processes GitHub's webhooks
Stars: ✭ 25 (-65.28%)
Mutual labels:  parsing
scala-csv-parser
CSV parser library.
Stars: ✭ 24 (-66.67%)
Mutual labels:  parsing
json2object
Type safe Haxe/JSON (de)serializer
Stars: ✭ 54 (-25%)
Mutual labels:  parsing
desktop
Extendable calculator for the 21st Century ⚡
Stars: ✭ 85 (+18.06%)
Mutual labels:  parsing
xcfg
X (weighted / probabilistic) Context-Free Grammars
Stars: ✭ 17 (-76.39%)
Mutual labels:  parsing
pdfmajor
A better PDF Extraction Tool using the latest and fastest python features
Stars: ✭ 19 (-73.61%)
Mutual labels:  parsing
disco-dop
Discontinuous Data-Oriented Parsing
Stars: ✭ 40 (-44.44%)
Mutual labels:  parsing
hxjsonast
Parse JSON into position-aware AST with Haxe!
Stars: ✭ 28 (-61.11%)
Mutual labels:  parsing
clojure-dsl-resources
A curated list of Clojure resources for dealing with domain-specific languages.
Stars: ✭ 99 (+37.5%)
Mutual labels:  parsing
MimeParser
Mime parsing in Swift | Relevant RFCs: RFC 822, RFC 2045, RFC 2046
Stars: ✭ 18 (-75%)
Mutual labels:  parsing
ohm-editor
An IDE for the Ohm language (JavaScript edition)
Stars: ✭ 78 (+8.33%)
Mutual labels:  parsing
m3u8
Parse and generate m3u8 playlists for Apple HTTP Live Streaming (HLS) in Ruby.
Stars: ✭ 96 (+33.33%)
Mutual labels:  parsing
Miksilo
The fastest way to build a language
Stars: ✭ 27 (-62.5%)
Mutual labels:  parsing
parser-combinators
Lightweight package providing commonly useful parser combinators
Stars: ✭ 41 (-43.06%)
Mutual labels:  parsing
humanparser
Parse a human name string into salutation, first name, middle name, last name, suffix.
Stars: ✭ 78 (+8.33%)
Mutual labels:  parsing
supotato
Classify (.h) header files into a text (.txt) report according to the first 2 letters of each file name.
Stars: ✭ 24 (-66.67%)
Mutual labels:  headers
Bullwinkle
An on-the-fly parser for BNF grammars
Stars: ✭ 39 (-45.83%)
Mutual labels:  parsing
LeagueReplayParser
C# library which can read some data from a .rofl file, and start a replay in the client. (no longer actively maintained)
Stars: ✭ 20 (-72.22%)
Mutual labels:  parsing
python-yamlable
A thin wrapper of PyYaml to convert Python objects to YAML and back
Stars: ✭ 28 (-61.11%)
Mutual labels:  parsing

httphead.go

GoDoc

Tiny HTTP header value parsing library in go.

Overview

This library contains low-level functions for scanning HTTP RFC2616 compatible header value grammars.

Install

    go get github.com/gobwas/httphead

Example

The example below shows how multiple-choise HTTP header value could be parsed with this library:

	options, ok := httphead.ParseOptions([]byte(`foo;bar=1,baz`), nil)
	fmt.Println(options, ok)
	// Output: [{foo map[bar:1]} {baz map[]}] true

The low-level example below shows how to optimize keys skipping and selection of some key:

	// The right part of full header line like:
	// X-My-Header: key;foo=bar;baz,key;baz
	header := []byte(`foo;a=0,foo;a=1,foo;a=2,foo;a=3`)

	// We want to search key "foo" with an "a" parameter that equal to "2".
	var (
		foo = []byte(`foo`)
		a   = []byte(`a`)
		v   = []byte(`2`)
	)
	var found bool
	httphead.ScanOptions(header, func(i int, key, param, value []byte) Control {
		if !bytes.Equal(key, foo) {
			return ControlSkip
		}
		if !bytes.Equal(param, a) {
			if bytes.Equal(value, v) {
				// Found it!
				found = true
				return ControlBreak
			}
			return ControlSkip
		}
		return ControlContinue
	})

For more usage examples please see docs or package tests.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].