tp2 0.5 → 0.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a9c8c52c6ec2e5db6393b54f0ccf96010c9c626984ea943075f1675a078e9eae
4
- data.tar.gz: 80cf94801b882350e72d50b21e9e004c544d239e3a05e04e99db4543e88deb73
3
+ metadata.gz: 02dcea75056239e37b8cd92705737bf8516719723b63f6610667f657b9d42667
4
+ data.tar.gz: 22660d26e8e6c92c84b033b12f8a095e1eb35d5273067020bb9393dc2560581f
5
5
  SHA512:
6
- metadata.gz: 48484025b54dc3a7ea959c795ed6575d62eae1165f97ed5171343616af84da1fce9cc2e818f7e3fb540dab146b6f0bd8e1a076fba6050e03cb78cfd479615449
7
- data.tar.gz: a3a65e353b9a5f4c1d4d3af7a4a6977f77ed7c38a1c10eb85c4a4afbbc6cc4a4c8e244be482c66b9e1ce6c61b52ffd0755959e3dff545d87b310011598baec9a
6
+ metadata.gz: '0783815bf52da7c2f1cb813022f2717adaa2cd6b169923d72c5817b255a1a4d2139b46e47b0f46ff085080af4b8fcf3c5065ac2d3b29a974f7417ce13f0cd1e6'
7
+ data.tar.gz: f9720342b6c7a9b78b70c45fadbd5f9dc95ed7720f0c40a60716a963e935acdeb01bc8d338b5cce759b81c4b76ee6e0361e37f519f89a9fca3e03a5b5395654a
@@ -0,0 +1,24 @@
1
+ name: Tests
2
+
3
+ on: [push, pull_request]
4
+
5
+ jobs:
6
+ build:
7
+ strategy:
8
+ fail-fast: false
9
+ matrix:
10
+ os: [ubuntu-latest]
11
+ ruby: [3.4, 'head']
12
+
13
+ name: >-
14
+ ${{matrix.os}}, ${{matrix.ruby}}
15
+
16
+ runs-on: ${{matrix.os}}
17
+ steps:
18
+ - uses: actions/checkout@v3
19
+ - uses: ruby/setup-ruby@v1
20
+ with:
21
+ ruby-version: ${{matrix.ruby}}
22
+ bundler-cache: true
23
+ - name: Run tests
24
+ run: bundle exec rake test
data/.gitignore CHANGED
@@ -45,7 +45,7 @@ build-iPhoneSimulator/
45
45
 
46
46
  # for a library or gem, you might want to ignore these files since the code is
47
47
  # intended to run in multiple environments; otherwise, check them in:
48
- # Gemfile.lock
48
+ Gemfile.lock
49
49
  # .ruby-version
50
50
  # .ruby-gemset
51
51
 
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # Version 0.6 2025-05-05
2
+
3
+ - Update UringMachine to 0.10
4
+
5
+ # Version 0.5.2 2025-05-05
6
+
7
+ - Update UringMachine to 0.8.2
8
+
1
9
  # Version 0.5 2025-05-05
2
10
 
3
11
  - Implement graceful shutdown
data/README.md CHANGED
@@ -1,5 +1,12 @@
1
- # tp2
1
+ # TP2
2
2
 
3
3
  TP2 is an experimental HTTP server based on
4
- [UringMachine](https://github.com/digital-fabric/uringmachine) and [Qeweney](https://github.com/digital-fabric/qeweney).
4
+ [UringMachine](https://github.com/digital-fabric/uringmachine) and [Qeweney](https://github.com/digital-fabric/qeweney).
5
5
 
6
+ ## Features
7
+
8
+ - HTTP/1.1
9
+ - Support for streaming requests and responses
10
+ - Automatic chunked transfer encoding
11
+ - Fast, native HTTP protocol parsing (no dependency)
12
+ - Graceful shutdown
data/Rakefile CHANGED
@@ -12,7 +12,7 @@ end
12
12
  task :release do
13
13
  require_relative './lib/tp2/version'
14
14
  version = TP2::VERSION
15
-
15
+
16
16
  puts 'Building tp2...'
17
17
  `gem build tp2.gemspec`
18
18
 
@@ -68,7 +68,7 @@ module TP2
68
68
 
69
69
  return nil if headers[':body-done-reading']
70
70
 
71
- # if content-length is not specified, we read to EOF, up to max 1MB size
71
+ # if content-length is not specified, we read to EOF, up to max 1MB size
72
72
  chunk = read(1 << 20, nil, false)
73
73
  headers[':body-done-reading'] = true
74
74
  chunk
@@ -162,17 +162,17 @@ module TP2
162
162
  def parse_headers
163
163
  headers = get_request_line
164
164
  return nil if !headers
165
-
165
+
166
166
  while true
167
167
  line = get_line
168
168
  break if line.nil? || line.empty?
169
169
 
170
170
  m = line.match(RE_HEADER_LINE)
171
171
  raise ProtocolError, 'Invalid header' if !m
172
-
172
+
173
173
  headers[m[1].downcase] = m[2]
174
174
  end
175
-
175
+
176
176
  headers
177
177
  end
178
178
 
@@ -180,7 +180,7 @@ module TP2
180
180
  while true
181
181
  line = @sio.gets(chomp: true)
182
182
  return line if line
183
-
183
+
184
184
  res = @machine.read(@fd, @buffer, 65536, -1)
185
185
  return nil if res == 0
186
186
  end
@@ -189,10 +189,10 @@ module TP2
189
189
  def get_request_line
190
190
  line = get_line
191
191
  return nil if !line
192
-
192
+
193
193
  m = line.match(RE_REQUEST_LINE)
194
194
  raise ProtocolError, 'Invalid request line' if !m
195
-
195
+
196
196
  {
197
197
  ':method' => m[1].downcase,
198
198
  ':path' => m[2],
@@ -229,7 +229,7 @@ module TP2
229
229
 
230
230
  return buf
231
231
  end
232
-
232
+
233
233
 
234
234
  left -= res
235
235
  end
@@ -239,7 +239,7 @@ module TP2
239
239
  def read_chunk(headers, buf)
240
240
  chunk_size = get_line
241
241
  return nil if !chunk_size
242
-
242
+
243
243
  chunk_size = chunk_size.to_i(16)
244
244
  if chunk_size == 0
245
245
  headers[':body-done-reading'] = true
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- p "request_extensions"
4
-
5
3
  class Qeweney::Request
6
4
  def serve_io(io, opts)
7
5
  # TODO: implement using UM
data/lib/tp2/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module TP2
2
- VERSION = '0.5'
2
+ VERSION = '0.6'
3
3
  end
@@ -452,23 +452,6 @@ class HTTP1AdapterTest < Minitest::Test
452
452
  p e.backtrace.join("\n")
453
453
  end
454
454
 
455
- opts = {
456
- upgrade: {
457
- echo: lambda do |adapter, _headers|
458
- conn = adapter.conn
459
- conn << <<~HTTP.crlf_lines
460
- HTTP/1.1 101 Switching Protocols
461
- Upgrade: echo
462
- Connection: Upgrade
463
-
464
- HTTP
465
-
466
- conn.read_loop { |data| conn << data }
467
- done = true
468
- end
469
- }
470
- }
471
-
472
455
  msg = "GET / HTTP/1.1\r\nUpgrade: echo\r\nConnection: upgrade\r\n\r\n"
473
456
  write_http_request(msg, false)
474
457
  @machine.spin { @adapter.serve_request rescue nil }
data/tp2.gemspec CHANGED
@@ -19,6 +19,6 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ['lib']
20
20
  s.required_ruby_version = '>= 3.4'
21
21
 
22
- s.add_dependency 'uringmachine', '0.8'
22
+ s.add_dependency 'uringmachine', '0.10'
23
23
  s.add_dependency 'qeweney', '0.21'
24
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tp2
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.5'
4
+ version: '0.6'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sharon Rosner
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - '='
17
17
  - !ruby/object:Gem::Version
18
- version: '0.8'
18
+ version: '0.10'
19
19
  type: :runtime
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - '='
24
24
  - !ruby/object:Gem::Version
25
- version: '0.8'
25
+ version: '0.10'
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: qeweney
28
28
  requirement: !ruby/object:Gem::Requirement
@@ -43,10 +43,10 @@ extensions: []
43
43
  extra_rdoc_files:
44
44
  - README.md
45
45
  files:
46
+ - ".github/workflows/test.yml"
46
47
  - ".gitignore"
47
48
  - CHANGELOG.md
48
49
  - Gemfile
49
- - Gemfile.lock
50
50
  - README.md
51
51
  - Rakefile
52
52
  - TODO.md
data/Gemfile.lock DELETED
@@ -1,62 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- tp2 (0.5)
5
- qeweney (= 0.21)
6
- uringmachine (= 0.8)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- docile (1.4.1)
12
- escape_utils (1.3.0)
13
- ffi (1.17.2-aarch64-linux-gnu)
14
- ffi (1.17.2-aarch64-linux-musl)
15
- ffi (1.17.2-arm-linux-gnu)
16
- ffi (1.17.2-arm-linux-musl)
17
- ffi (1.17.2-arm64-darwin)
18
- ffi (1.17.2-x86_64-darwin)
19
- ffi (1.17.2-x86_64-linux-gnu)
20
- ffi (1.17.2-x86_64-linux-musl)
21
- listen (3.9.0)
22
- rb-fsevent (~> 0.10, >= 0.10.3)
23
- rb-inotify (~> 0.9, >= 0.9.10)
24
- minitest (5.25.4)
25
- qeweney (0.21)
26
- escape_utils (= 1.3.0)
27
- rake (13.2.1)
28
- rake-compiler (1.2.9)
29
- rake
30
- rb-fsevent (0.11.2)
31
- rb-inotify (0.11.1)
32
- ffi (~> 1.0)
33
- simplecov (0.22.0)
34
- docile (~> 1.1)
35
- simplecov-html (~> 0.11)
36
- simplecov_json_formatter (~> 0.1)
37
- simplecov-html (0.13.1)
38
- simplecov_json_formatter (0.1.4)
39
- uringmachine (0.8)
40
- yard (0.9.37)
41
-
42
- PLATFORMS
43
- aarch64-linux-gnu
44
- aarch64-linux-musl
45
- arm-linux-gnu
46
- arm-linux-musl
47
- arm64-darwin
48
- x86_64-darwin
49
- x86_64-linux-gnu
50
- x86_64-linux-musl
51
-
52
- DEPENDENCIES
53
- listen (= 3.9.0)
54
- minitest (= 5.25.4)
55
- rake (= 13.2.1)
56
- rake-compiler (= 1.2.9)
57
- simplecov (= 0.22.0)
58
- tp2!
59
- yard (= 0.9.37)
60
-
61
- BUNDLED WITH
62
- 2.6.2