llhttp 0.0.2 → 0.0.3

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.
@@ -1,36 +1,64 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLHttp
4
- # Delegate for handling callbacks. Subclass this, implementing the necessary methods.
4
+ # [public] Delegate for handling callbacks. Subclass this object and implement necessary methods.
5
+ #
6
+ # class Delegate < LLHttp::Delegate
7
+ # def on_message_begin
8
+ # ...
9
+ # end
10
+ #
11
+ # ...
12
+ # end
5
13
  #
6
14
  class Delegate
15
+ # [public]
16
+ #
7
17
  def on_message_begin
8
18
  end
9
19
 
20
+ # [public]
21
+ #
10
22
  def on_url(url)
11
23
  end
12
24
 
25
+ # [public]
26
+ #
13
27
  def on_status(status)
14
28
  end
15
29
 
30
+ # [public]
31
+ #
16
32
  def on_header_field(field)
17
33
  end
18
34
 
35
+ # [public]
36
+ #
19
37
  def on_header_value(value)
20
38
  end
21
39
 
40
+ # [public]
41
+ #
22
42
  def on_headers_complete
23
43
  end
24
44
 
45
+ # [public]
46
+ #
25
47
  def on_body(body)
26
48
  end
27
49
 
50
+ # [public]
51
+ #
28
52
  def on_message_complete
29
53
  end
30
54
 
55
+ # [public]
56
+ #
31
57
  def on_chunk_header
32
58
  end
33
59
 
60
+ # [public]
61
+ #
34
62
  def on_chunk_complete
35
63
  end
36
64
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLHttp
4
+ # [public] LLHttp's standard error object.
5
+ #
4
6
  class Error < StandardError
5
7
  end
6
8
  end
@@ -1,21 +1,38 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLHttp
4
- # Wraps an llhttp context for parsing http requests and responses.
4
+ # [public] Wraps an llhttp context for parsing http requests and responses.
5
5
  #
6
- # = Finishing
6
+ # class Delegate < LLHttp::Delegate
7
+ # def on_message_begin
8
+ # ...
9
+ # end
7
10
  #
8
- # Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
11
+ # ...
12
+ # end
9
13
  #
10
- # = Introspection
14
+ # parser = LLHttp::Parser.new(Delegate.new, type: :request)
15
+ # parser << "GET / HTTP/1.1\r\n\r\n"
16
+ # parser.finish
11
17
  #
12
- # * `LLHttp::Parser#content_length` returns the content length of the current request.
13
- # * `LLHttp::Parser#method` returns the method of the current response.
14
- # * `LLHttp::Parser#keep_alive?` returns `true` if there might be any other messages following the last that was successfuly parsed.
18
+ # ...
19
+ #
20
+ # Introspection
21
+ #
22
+ # * `LLHttp::Parser#content_length` returns the content length of the current request.
23
+ # * `LLHttp::Parser#method` returns the method of the current response.
24
+ # * `LLHttp::Parser#status_code` returns the status code of the current response.
25
+ # * `LLHttp::Parser#keep_alive?` returns `true` if there might be more messages.
26
+ #
27
+ # Finishing
28
+ #
29
+ # Call `LLHttp::Parser#finish` when processing is complete for the current request or response.
15
30
  #
16
31
  class Parser
17
32
  LLHTTP_TYPES = {both: 0, request: 1, response: 2}.freeze
18
33
 
34
+ # [public] The parser type; one of: `both`, `request`, or `response`.
35
+ #
19
36
  attr_reader :type
20
37
 
21
38
  def initialize(delegate, type: :both)
@@ -26,4 +43,4 @@ module LLHttp
26
43
  end
27
44
  end
28
45
 
29
- require_relative "llhttp_ext"
46
+ require_relative "../llhttp_ext"
@@ -1,8 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LLHttp
4
- VERSION = "0.0.2"
4
+ VERSION = "0.0.3"
5
5
 
6
+ # [public] LLHttp's current version.
7
+ #
6
8
  def self.version
7
9
  VERSION
8
10
  end
metadata CHANGED
@@ -1,17 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: llhttp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bryan Powell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-12 00:00:00.000000000 Z
11
+ date: 2020-12-31 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby bindings for llhttp.
14
- email: bryan@bryanp.org
14
+ email: bryan@metabahn.com
15
15
  executables: []
16
16
  extensions:
17
17
  - ext/llhttp/extconf.rb
@@ -20,11 +20,15 @@ files:
20
20
  - CHANGELOG.md
21
21
  - LICENSE
22
22
  - README.md
23
+ - ext/llhttp/api.c
23
24
  - ext/llhttp/extconf.rb
25
+ - ext/llhttp/http.c
26
+ - ext/llhttp/llhttp.c
27
+ - ext/llhttp/llhttp.h
28
+ - ext/llhttp/llhttp_ext.c
24
29
  - lib/llhttp.rb
25
30
  - lib/llhttp/delegate.rb
26
31
  - lib/llhttp/error.rb
27
- - lib/llhttp/llhttp_ext.bundle
28
32
  - lib/llhttp/parser.rb
29
33
  - lib/llhttp/version.rb
30
34
  homepage: https://github.com/metabahn/llhttp/
@@ -46,7 +50,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
46
50
  - !ruby/object:Gem::Version
47
51
  version: '0'
48
52
  requirements: []
49
- rubygems_version: 3.1.2
53
+ rubygems_version: 3.2.3
50
54
  signing_key:
51
55
  specification_version: 4
52
56
  summary: Ruby bindings for llhttp.
Binary file