llhttp 0.0.3 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +32 -0
- data/LICENSE +353 -22
- data/README.md +1 -1
- data/ext/llhttp/api.c +170 -16
- data/ext/llhttp/http.c +31 -2
- data/ext/llhttp/llhttp.c +9729 -848
- data/ext/llhttp/llhttp.h +229 -26
- data/ext/llhttp/llhttp_ext.c +159 -75
- data/lib/llhttp/delegate.rb +71 -39
- data/lib/llhttp/parser.rb +7 -1
- data/lib/llhttp/version.rb +1 -1
- metadata +5 -5
data/lib/llhttp/delegate.rb
CHANGED
@@ -8,58 +8,90 @@ module LLHttp
|
|
8
8
|
# ...
|
9
9
|
# end
|
10
10
|
#
|
11
|
-
#
|
11
|
+
# def on_url(url)
|
12
|
+
# ...
|
13
|
+
# end
|
14
|
+
#
|
15
|
+
# def on_status(status)
|
16
|
+
# ...
|
17
|
+
# end
|
18
|
+
#
|
19
|
+
# def on_header_field(field)
|
20
|
+
# ...
|
21
|
+
# end
|
22
|
+
#
|
23
|
+
# def on_header_value(value)
|
24
|
+
# ...
|
25
|
+
# end
|
26
|
+
#
|
27
|
+
# def on_headers_complete
|
28
|
+
# ...
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# def on_body(body)
|
32
|
+
# ...
|
33
|
+
# end
|
34
|
+
#
|
35
|
+
# def on_message_complete
|
36
|
+
# ...
|
37
|
+
# end
|
38
|
+
#
|
39
|
+
# def on_chunk_header
|
40
|
+
# ...
|
41
|
+
# end
|
42
|
+
#
|
43
|
+
# def on_chunk_complete
|
44
|
+
# ...
|
45
|
+
# end
|
46
|
+
#
|
47
|
+
# def on_url_complete
|
48
|
+
# ...
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# def on_status_complete
|
52
|
+
# ...
|
53
|
+
# end
|
54
|
+
#
|
55
|
+
# def on_header_field_complete
|
56
|
+
# ...
|
57
|
+
# end
|
58
|
+
#
|
59
|
+
# def on_header_value_complete
|
60
|
+
# ...
|
61
|
+
# end
|
12
62
|
# end
|
13
63
|
#
|
14
64
|
class Delegate
|
15
|
-
|
16
|
-
|
17
|
-
def on_message_begin
|
18
|
-
end
|
65
|
+
private def internal_on_message_begin
|
66
|
+
on_message_begin
|
19
67
|
|
20
|
-
|
21
|
-
|
22
|
-
|
68
|
+
0
|
69
|
+
rescue
|
70
|
+
-1
|
23
71
|
end
|
24
72
|
|
25
|
-
|
26
|
-
|
27
|
-
def on_status(status)
|
28
|
-
end
|
73
|
+
private def internal_on_headers_complete
|
74
|
+
on_headers_complete
|
29
75
|
|
30
|
-
|
31
|
-
|
32
|
-
|
76
|
+
0
|
77
|
+
rescue
|
78
|
+
-1
|
33
79
|
end
|
34
80
|
|
35
|
-
|
36
|
-
|
37
|
-
def on_header_value(value)
|
38
|
-
end
|
81
|
+
private def internal_on_message_complete
|
82
|
+
on_message_complete
|
39
83
|
|
40
|
-
|
41
|
-
|
42
|
-
|
84
|
+
0
|
85
|
+
rescue
|
86
|
+
-1
|
43
87
|
end
|
44
88
|
|
45
|
-
|
46
|
-
|
47
|
-
def on_body(body)
|
48
|
-
end
|
49
|
-
|
50
|
-
# [public]
|
51
|
-
#
|
52
|
-
def on_message_complete
|
53
|
-
end
|
54
|
-
|
55
|
-
# [public]
|
56
|
-
#
|
57
|
-
def on_chunk_header
|
58
|
-
end
|
89
|
+
private def internal_on_chunk_header
|
90
|
+
on_chunk_header
|
59
91
|
|
60
|
-
|
61
|
-
|
62
|
-
|
92
|
+
0
|
93
|
+
rescue
|
94
|
+
-1
|
63
95
|
end
|
64
96
|
end
|
65
97
|
end
|
data/lib/llhttp/parser.rb
CHANGED
@@ -20,14 +20,20 @@ module LLHttp
|
|
20
20
|
# Introspection
|
21
21
|
#
|
22
22
|
# * `LLHttp::Parser#content_length` returns the content length of the current request.
|
23
|
-
# * `LLHttp::Parser#
|
23
|
+
# * `LLHttp::Parser#method_name` returns the method name of the current response.
|
24
24
|
# * `LLHttp::Parser#status_code` returns the status code of the current response.
|
25
|
+
# * `LLHttp::Parser#http_major` returns the major http version of the current request/response.
|
26
|
+
# * `LLHttp::Parser#http_minor` returns the minor http version of the current request/response.
|
25
27
|
# * `LLHttp::Parser#keep_alive?` returns `true` if there might be more messages.
|
26
28
|
#
|
27
29
|
# Finishing
|
28
30
|
#
|
29
31
|
# Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
|
30
32
|
#
|
33
|
+
# Resetting
|
34
|
+
#
|
35
|
+
# Call `LLHttp::Parser#reset` to reset the parser for the next request or response.
|
36
|
+
#
|
31
37
|
class Parser
|
32
38
|
LLHTTP_TYPES = {both: 0, request: 1, response: 2}.freeze
|
33
39
|
|
data/lib/llhttp/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: llhttp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Powell
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-09-09 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby bindings for llhttp.
|
14
14
|
email: bryan@metabahn.com
|
@@ -33,7 +33,7 @@ files:
|
|
33
33
|
- lib/llhttp/version.rb
|
34
34
|
homepage: https://github.com/metabahn/llhttp/
|
35
35
|
licenses:
|
36
|
-
-
|
36
|
+
- MPL-2.0
|
37
37
|
metadata: {}
|
38
38
|
post_install_message:
|
39
39
|
rdoc_options: []
|
@@ -43,14 +43,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
43
43
|
requirements:
|
44
44
|
- - ">="
|
45
45
|
- !ruby/object:Gem::Version
|
46
|
-
version: 2.
|
46
|
+
version: 2.6.7
|
47
47
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
48
48
|
requirements:
|
49
49
|
- - ">="
|
50
50
|
- !ruby/object:Gem::Version
|
51
51
|
version: '0'
|
52
52
|
requirements: []
|
53
|
-
rubygems_version: 3.2.
|
53
|
+
rubygems_version: 3.2.15
|
54
54
|
signing_key:
|
55
55
|
specification_version: 4
|
56
56
|
summary: Ruby bindings for llhttp.
|