protocol-http 0.30.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5365fcaf109db92e1db6bc6389e881881f7ec19c4f1bcd747b16d72698e89a7c
4
- data.tar.gz: 11f68df5f5b9370579764e475a0fe1579c3b4d2f06aaed80efb0cb5fa5c6e392
3
+ metadata.gz: c0e3d21463ec1b9dc0e08f2215f51135dc40342b5d922d4d827f2e43bbd0cc19
4
+ data.tar.gz: b6372b9064511569270558da4fc43dc792a5fe11d56caad820ba52cc997bcba1
5
5
  SHA512:
6
- metadata.gz: 05f867a38d373f1491630bc5a9bf30401b8ac0fa41cec5392787a1fb916d42fa0f14ff8b80078b89246ab5bbdaae40b2dd67b77302571e3cb0803477e48ead4f
7
- data.tar.gz: dbb7ac119a2d46c5150b8a274c89280582d69f64718849a7537d0a4b876f40c0b9a36c47fc3e2d6f27a244e12465d4ba372a3e4c87c7d0e1c738c0757cd672d5
6
+ metadata.gz: 0d26f9ee12048761f8a921f6f9d9b921a3baae9f4d10a00dae7800a4d1549da4b86c51cf9dd7b699e6e862273bd76528ea77401ad92f79367e141d3d45307798
7
+ data.tar.gz: f8fe391ecdcb104fc5886cf6f2e1ad86a5f9599df6a532218201623188972f0b6249ff75c72663afe172677feb14d111b70a419cced7ad4fe3f6fcd4abf58d3d
checksums.yaml.gz.sig CHANGED
@@ -1,2 +1 @@
1
- y}��A��:/��+P�\��<7Ao>����7�J�֔�Se�ߴ[\�`e�II�R4Ð\�`�Vl@��.��l��uC�/"fK�����_���Қ:������Vr1o<���� �aBҽ� \��7�%�H�+x�=���M����>���������>n��y�Q$:�
2
- �1f��8���u��|4j�q�vle�D�5/��N�sb�>�+��0*��\�iI#�4��l����z^�2�V���~���B.J�fH����Fy����<����d� �7Bת�1��(��@��e�yњ�����W��LO1q<�K���k�5�b�w��-�9w2��Dž�0+(vudF�o���/]��tK�sJ�!����lAV�j`;h?�%.z
1
+ ��?ӳ����&dž�fM��le���6�Ōz�d��X y�~���D��[�#�{�s�\6�ƕ�y4����6h�,e�8���Eu��b���(�������q��C�H[N
@@ -57,9 +57,12 @@ module Protocol
57
57
  def call(stream)
58
58
  while chunk = self.read
59
59
  stream.write(chunk)
60
+
61
+ # Flush the stream unless we are immediately expecting more data:
62
+ unless self.ready?
63
+ stream.flush
64
+ end
60
65
  end
61
- ensure
62
- stream.close
63
66
  end
64
67
 
65
68
  # Read all remaining chunks into a buffered body and close the underlying input.
@@ -69,10 +69,10 @@ module Protocol
69
69
  end
70
70
  end
71
71
 
72
- self.each do |name, value|
72
+ self.each do |name, method|
73
73
  define_method(name) do |location, *arguments, **options|
74
74
  self.call(
75
- Request[value, location.to_s, *arguments, **options]
75
+ Request[method, location.to_s, *arguments, **options]
76
76
  )
77
77
  end
78
78
  end
@@ -5,6 +5,6 @@
5
5
 
6
6
  module Protocol
7
7
  module HTTP
8
- VERSION = "0.30.0"
8
+ VERSION = "0.32.0"
9
9
  end
10
10
  end
data/readme.md CHANGED
@@ -22,7 +22,11 @@ Please see the [project documentation](https://socketry.github.io/protocol-http/
22
22
 
23
23
  Please see the [project releases](https://socketry.github.io/protocol-http/releases/index) for all releases.
24
24
 
25
- ### Unreleased
25
+ ### v0.31.0
26
+
27
+ - Ensure chunks are flushed if required, when streaming.
28
+
29
+ ### v0.30.0
26
30
 
27
31
  - [`Request[]` and `Response[]` Keyword Arguments](https://socketry.github.io/protocol-http/releases/index#request[]-and-response[]-keyword-arguments)
28
32
  - [Interim Response Handling](https://socketry.github.io/protocol-http/releases/index#interim-response-handling)
data/releases.md CHANGED
@@ -1,12 +1,16 @@
1
1
  # Releases
2
2
 
3
- ## Unreleased
3
+ ## v0.31.0
4
+
5
+ - Ensure chunks are flushed if required, when streaming.
6
+
7
+ ## v0.30.0
4
8
 
5
9
  ### `Request[]` and `Response[]` Keyword Arguments
6
10
 
7
11
  The `Request[]` and `Response[]` methods now support keyword arguments as a convenient way to set various positional arguments.
8
12
 
9
- ```ruby
13
+ ``` ruby
10
14
  # Request keyword arguments:
11
15
  client.get("/", headers: {"accept" => "text/html"}, authority: "example.com")
12
16
 
@@ -21,14 +25,14 @@ The `Request` class now exposes a `#interim_response` attribute which can be use
21
25
 
22
26
  On the client side, you can pass a callback using the `interim_response` keyword argument which will be invoked whenever an interim response is received:
23
27
 
24
- ```ruby
28
+ ``` ruby
25
29
  client = ...
26
30
  response = client.get("/index", interim_response: proc{|status, headers| ...})
27
31
  ```
28
32
 
29
33
  On the server side, you can send an interim response using the `#send_interim_response` method:
30
34
 
31
- ```ruby
35
+ ``` ruby
32
36
  def call(request)
33
37
  if request.headers["expect"] == "100-continue"
34
38
  # Send an interim response:
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.30.0
4
+ version: 0.32.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
@@ -47,7 +47,7 @@ cert_chain:
47
47
  Q2K9NVun/S785AP05vKkXZEFYxqG6EW012U4oLcFl5MySFajYXRYbuUpH6AY+HP8
48
48
  voD0MPg1DssDLKwXyt1eKD/+Fq0bFWhwVM/1XiAXL7lyYUyOq24KHgQ2Csg=
49
49
  -----END CERTIFICATE-----
50
- date: 2024-08-30 00:00:00.000000000 Z
50
+ date: 2024-09-03 00:00:00.000000000 Z
51
51
  dependencies: []
52
52
  description:
53
53
  email:
metadata.gz.sig CHANGED
Binary file