protocol-http1 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of protocol-http1 might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c7e52fddf7aecf5b02e7409c22602514f254f4c2a9a996ec3f6a756105264ff4
4
- data.tar.gz: c935b95535f01ebc686bed3c4ada973cc6d7c3a7993e660fe4421fff1e16d6dd
3
+ metadata.gz: 815238149caf3e1fd7ee9f4c049488bd3eba0f669ed98a0491ad26d68b854157
4
+ data.tar.gz: d5d7cf91e4c19039ca8dbe506bd51d3c3f2ecb106c3e73f77a737068be8ea8db
5
5
  SHA512:
6
- metadata.gz: 548692d4ff0abdb92aeb40e6cd454ee59755ee78433ea4c273a9f0e2df8033f495095f38b7304c5d816ddce53a1387c3d7ef85924bd42fa38ec86eb9f48eaa5e
7
- data.tar.gz: 340384e2f85326ae5a5dd38a87909ee33c2e5b346b07ab6f191f00ed1746104fe9f286b9fc5f5b6440b19b485ec1c7cd060979474ed082c61deaf6db4f573644
6
+ metadata.gz: '09c9c15b227b3c2c23adf7175c1b5610a31869dcac60b819870a51e2828ec78929e9210e210cb71a9c32f4ef95f07cd7f30c0320ee97893c8cf0994d503faff6'
7
+ data.tar.gz: 95252b355145060621c4c47fa367d37a3c3bf2d1155bafcee3bd921eb8f3c9d3a542750d5ddbf7038fd5bbee3276b1cc5e80545c3347f99443e283ffe7aaf814
@@ -84,9 +84,10 @@ module Protocol
84
84
  end
85
85
 
86
86
  def upgrade!(protocol)
87
- @upgrade = protocol
88
87
  @persistent = false
89
88
 
89
+ @upgrade = protocol
90
+
90
91
  return @stream
91
92
  end
92
93
 
@@ -212,14 +213,17 @@ module Protocol
212
213
  return chunk
213
214
  end
214
215
 
215
- def write_upgrade_body
216
+ def write_upgrade_body(body = nil)
217
+ # Any time we are potentially closing the stream, we should ensure no further requests are processed:
218
+ @persistent = false
219
+
216
220
  @stream.write("\r\n")
217
221
  @stream.flush
218
222
 
219
- return @stream unless block_given?
223
+ return @stream unless body
220
224
 
221
225
  begin
222
- yield @stream
226
+ body.call(@stream)
223
227
  rescue
224
228
  @stream.close_write
225
229
  end
@@ -307,7 +311,7 @@ module Protocol
307
311
  if body.nil? or body.empty?
308
312
  write_empty_body(body)
309
313
  elsif body.respond_to?(:call)
310
- write_upgrade_body(&body)
314
+ write_upgrade_body(body)
311
315
  elsif length = body.length
312
316
  write_fixed_length_body(body, length, head)
313
317
  elsif @persistent and chunked
@@ -1,5 +1,5 @@
1
1
  module Protocol
2
2
  module HTTP1
3
- VERSION = "0.2.0"
3
+ VERSION = "0.3.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http1
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-08 00:00:00.000000000 Z
11
+ date: 2019-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protocol-http