Skip to content

Commit 5dd9dff

Browse files
committed
Add llhttp-ffi gem
Minimal stubs for LLHttp::Parser, LLHttp::Delegate, and LLHttp::Error — just the surface referenced by the http gem's bundled sig/http.rbs (class Handler < LLHttp::Delegate, attr_reader parser: LLHttp::Parser) plus the Parser methods http's Response::Parser calls. Unblocks Steep users of the http gem, which otherwise fails signature load with RBS::NoSuperclassFoundError on LLHttp::Delegate.
1 parent a78dec9 commit 5dd9dff

3 files changed

Lines changed: 30 additions & 0 deletions

File tree

gems/llhttp-ffi/0.5/_test/test.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
require "llhttp"
2+
3+
class MyDelegate < LLHttp::Delegate
4+
end
5+
6+
parser = LLHttp::Parser.new(MyDelegate.new, type: :response)
7+
parser.reset
8+
parser << "HTTP/1.1 200 OK\r\n\r\n"
9+
parser.status_code
10+
parser.http_major
11+
parser.http_minor

gems/llhttp-ffi/0.5/_test/test.rbs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
class MyDelegate < LLHttp::Delegate
2+
end

gems/llhttp-ffi/0.5/llhttp-ffi.rbs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module LLHttp
2+
class Error < StandardError
3+
end
4+
5+
class Parser
6+
def initialize: (untyped delegate, ?type: Symbol) -> void
7+
def reset: () -> void
8+
def <<: (String data) -> void
9+
def status_code: () -> Integer
10+
def http_major: () -> Integer
11+
def http_minor: () -> Integer
12+
end
13+
14+
class Delegate
15+
def initialize: () -> void
16+
end
17+
end

0 commit comments

Comments
 (0)