http-parser-lite 0.6.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG +4 -0
- data/README.md +5 -0
- data/ext/http-parser/ruby_http_parser.c +2 -2
- data/lib/http-parser.rb +10 -2
- data/test/test_http_parser.rb +7 -0
- metadata +34 -24
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 2644da08c5a1999e20e3f05e28731050e6b393e9170f7d902783b3f601d5b71d
|
4
|
+
data.tar.gz: b0cd1d650e9fceea8e63b7323b8f61bb5f379af86295762af030a14845a6ada4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: e145fe33cdba596bd7e2816533fb03f1458ddf3326ebe971b85dde6743baf6b7e4778e647f21258702065e2f0fe6d7ab0f539589b61271c445dbcc75d376f0aa
|
7
|
+
data.tar.gz: 9b53c39d4db51d76a06bd671ff621a795e5534b0207e32118e335d898706f7c9c86e29d8002d13a2a06fe6f054f5a2f554b3c4050f161d839cd3a257d17827df
|
data/CHANGELOG
CHANGED
data/README.md
CHANGED
@@ -97,6 +97,11 @@ Exceptions:
|
|
97
97
|
* HTTP::Parser::Error
|
98
98
|
```
|
99
99
|
|
100
|
+
## JRuby Support
|
101
|
+
|
102
|
+
Based on [flyerhzm/http-parser.java](https://github.com/flyerhzm/http-parser.java), some code has been borrowed from
|
103
|
+
[http_parser.rb](https://github.com/tmm1/http_parser.rb)
|
104
|
+
|
100
105
|
## License
|
101
106
|
|
102
107
|
MIT
|
@@ -149,8 +149,8 @@ VALUE rb_parser_error_q(VALUE self) {
|
|
149
149
|
|
150
150
|
VALUE rb_parser_error(VALUE self) {
|
151
151
|
http_parser *parser = rb_http_parser_handle(self);
|
152
|
-
int
|
153
|
-
return
|
152
|
+
int http_errno = HTTP_PARSER_ERRNO(parser);
|
153
|
+
return http_errno != HPE_OK ? rb_str_new2(http_errno_description(http_errno)) : Qnil;
|
154
154
|
}
|
155
155
|
|
156
156
|
void Init_http_parser() {
|
data/lib/http-parser.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
require 'http-parser/http_parser'
|
2
|
-
|
3
1
|
module HTTP
|
4
2
|
class Parser
|
3
|
+
VERSION = '1.0.0'.freeze
|
4
|
+
|
5
5
|
TYPE_REQUEST = 0
|
6
6
|
TYPE_RESPONSE = 1
|
7
7
|
TYPE_BOTH = 2
|
@@ -40,3 +40,11 @@ module HTTP
|
|
40
40
|
end
|
41
41
|
end
|
42
42
|
end
|
43
|
+
|
44
|
+
if RUBY_PLATFORM =~ /java/
|
45
|
+
require_relative '../ext/vendor/http-parser.jar'
|
46
|
+
require 'http-parser.jar'
|
47
|
+
require 'ruby_http_parser'
|
48
|
+
else
|
49
|
+
require 'http-parser/http_parser'
|
50
|
+
end
|
data/test/test_http_parser.rb
CHANGED
@@ -98,6 +98,12 @@ describe 'http-parser' do
|
|
98
98
|
assert_equal '1.1', parser.http_version
|
99
99
|
end
|
100
100
|
|
101
|
+
it 'should parse PATCH' do
|
102
|
+
parser << "PATCH http://example.com HTTP/1.1\r\nUser-Agent: X-Test-UA\r\n\r\n"
|
103
|
+
|
104
|
+
assert_equal 'PATCH', parser.http_method
|
105
|
+
end
|
106
|
+
|
101
107
|
it 'should raise an error on invalid data' do
|
102
108
|
assert_raises(HTTP::Parser::Error) { parser << "GET / foobar\r\n" }
|
103
109
|
end
|
@@ -176,6 +182,7 @@ describe 'http-parser' do
|
|
176
182
|
end
|
177
183
|
|
178
184
|
it 'should parser urls with user:pass' do
|
185
|
+
skip 'Not implemented in JRuby yet, see issues/2' if RUBY_PLATFORM =~ /java/
|
179
186
|
parser.reset(HTTP::Parser::TYPE_REQUEST)
|
180
187
|
|
181
188
|
url = 'http://foo:bar@example.org/test.cgi?param1=1'
|
metadata
CHANGED
@@ -1,32 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-parser-lite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.6.0
|
4
|
+
version: 1.0.0
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Bharanee Rathna
|
9
|
-
autorequire:
|
8
|
+
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2024-04-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
14
|
+
name: rake
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
15
20
|
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake-compiler
|
16
29
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
30
|
requirements:
|
19
|
-
- -
|
31
|
+
- - ">="
|
20
32
|
- !ruby/object:Gem::Version
|
21
33
|
version: '0'
|
34
|
+
type: :development
|
22
35
|
prerelease: false
|
23
36
|
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
none: false
|
25
37
|
requirements:
|
26
|
-
- -
|
38
|
+
- - ">="
|
27
39
|
- !ruby/object:Gem::Version
|
28
40
|
version: '0'
|
29
|
-
name: rake
|
30
41
|
description: A lite ruby wrapper around Joyent http-parser
|
31
42
|
email:
|
32
43
|
- deepfryed@gmail.com
|
@@ -35,39 +46,38 @@ extensions:
|
|
35
46
|
- ext/http-parser/extconf.rb
|
36
47
|
extra_rdoc_files: []
|
37
48
|
files:
|
49
|
+
- CHANGELOG
|
50
|
+
- README.md
|
51
|
+
- ext/http-parser/extconf.rb
|
38
52
|
- ext/http-parser/http_parser.c
|
39
|
-
- ext/http-parser/ruby_http_parser.c
|
40
53
|
- ext/http-parser/http_parser.h
|
41
|
-
- ext/http-parser/
|
42
|
-
- test/helper.rb
|
43
|
-
- test/test_http_parser.rb
|
54
|
+
- ext/http-parser/ruby_http_parser.c
|
44
55
|
- lib/http-parser-lite.rb
|
45
56
|
- lib/http-parser.rb
|
46
|
-
-
|
47
|
-
-
|
57
|
+
- test/helper.rb
|
58
|
+
- test/test_http_parser.rb
|
48
59
|
homepage: http://github.com/deepfryed/http-parser-lite
|
49
60
|
licenses: []
|
50
|
-
|
61
|
+
metadata: {}
|
62
|
+
post_install_message:
|
51
63
|
rdoc_options: []
|
52
64
|
require_paths:
|
53
65
|
- lib
|
54
66
|
- ext
|
55
67
|
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
-
none: false
|
57
68
|
requirements:
|
58
|
-
- -
|
69
|
+
- - ">="
|
59
70
|
- !ruby/object:Gem::Version
|
60
71
|
version: '0'
|
61
72
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
62
|
-
none: false
|
63
73
|
requirements:
|
64
|
-
- -
|
74
|
+
- - ">="
|
65
75
|
- !ruby/object:Gem::Version
|
66
76
|
version: '0'
|
67
77
|
requirements: []
|
68
|
-
rubyforge_project:
|
69
|
-
rubygems_version:
|
70
|
-
signing_key:
|
71
|
-
specification_version:
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.7.6
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
72
82
|
summary: Simple wrapper around Joyent http-parser
|
73
83
|
test_files: []
|