net-http-pipeline 0.0 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- data.tar.gz.sig +0 -0
- data/History.txt +6 -1
- data/README.txt +0 -1
- data/lib/net/http/pipeline.rb +11 -5
- data/test/test_net_http_pipeline.rb +15 -12
- metadata +12 -7
- metadata.gz.sig +4 -3
data.tar.gz.sig
CHANGED
Binary file
|
data/History.txt
CHANGED
data/README.txt
CHANGED
data/lib/net/http/pipeline.rb
CHANGED
@@ -24,7 +24,7 @@ require 'net/http'
|
|
24
24
|
|
25
25
|
module Net::HTTP::Pipeline
|
26
26
|
|
27
|
-
VERSION = '0.
|
27
|
+
VERSION = '0.1'
|
28
28
|
|
29
29
|
##
|
30
30
|
# Pipeline error class
|
@@ -83,11 +83,17 @@ module Net::HTTP::Pipeline
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
|
87
|
-
|
86
|
+
if Net::HTTPResponse.allocate.respond_to? :connection_close? then
|
87
|
+
##
|
88
|
+
# Checks for an connection close header
|
88
89
|
|
89
|
-
|
90
|
-
|
90
|
+
def pipeline_keep_alive? res
|
91
|
+
not res.connection_close?
|
92
|
+
end
|
93
|
+
else
|
94
|
+
def pipeline_keep_alive? res
|
95
|
+
not /close/i =~ res['connection'].to_s
|
96
|
+
end
|
91
97
|
end
|
92
98
|
|
93
99
|
end
|
@@ -1,8 +1,8 @@
|
|
1
|
-
require
|
1
|
+
require 'minitest/autorun'
|
2
2
|
require 'net/http/pipeline'
|
3
3
|
require 'stringio'
|
4
4
|
|
5
|
-
class TestNetHttpPipeline <
|
5
|
+
class TestNetHttpPipeline < MiniTest::Unit::TestCase
|
6
6
|
|
7
7
|
##
|
8
8
|
# Net::BufferedIO stub
|
@@ -68,6 +68,16 @@ class TestNetHttpPipeline < Test::Unit::TestCase
|
|
68
68
|
path
|
69
69
|
end
|
70
70
|
|
71
|
+
def http_request
|
72
|
+
http_request = []
|
73
|
+
http_request << 'GET / HTTP/1.1'
|
74
|
+
http_request << 'Accept: */*'
|
75
|
+
http_request << 'User-Agent: Ruby' if RUBY_VERSION > '1.9'
|
76
|
+
http_request.push nil, nil
|
77
|
+
|
78
|
+
http_request.join "\r\n"
|
79
|
+
end
|
80
|
+
|
71
81
|
def http_response body, *extra_header
|
72
82
|
http_response = []
|
73
83
|
http_response << 'HTTP/1.1 200 OK'
|
@@ -105,16 +115,9 @@ class TestNetHttpPipeline < Test::Unit::TestCase
|
|
105
115
|
|
106
116
|
@socket.finish
|
107
117
|
|
108
|
-
expected =
|
109
|
-
|
110
|
-
|
111
|
-
User-Agent: Ruby\r
|
112
|
-
\r
|
113
|
-
GET / HTTP/1.1\r
|
114
|
-
Accept: */*\r
|
115
|
-
User-Agent: Ruby\r
|
116
|
-
\r
|
117
|
-
EXPECTED
|
118
|
+
expected = ''
|
119
|
+
expected << http_request
|
120
|
+
expected << http_request
|
118
121
|
|
119
122
|
assert_equal expected, @socket.write_io.read
|
120
123
|
refute @socket.closed?
|
metadata
CHANGED
@@ -1,11 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: net-http-pipeline
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
+
hash: 9
|
4
5
|
prerelease: false
|
5
6
|
segments:
|
6
7
|
- 0
|
7
|
-
-
|
8
|
-
version: "0.
|
8
|
+
- 1
|
9
|
+
version: "0.1"
|
9
10
|
platform: ruby
|
10
11
|
authors:
|
11
12
|
- Eric Hodel
|
@@ -45,11 +46,12 @@ dependencies:
|
|
45
46
|
requirements:
|
46
47
|
- - ">="
|
47
48
|
- !ruby/object:Gem::Version
|
49
|
+
hash: 3
|
48
50
|
segments:
|
49
|
-
-
|
50
|
-
-
|
51
|
+
- 1
|
52
|
+
- 5
|
51
53
|
- 0
|
52
|
-
version:
|
54
|
+
version: 1.5.0
|
53
55
|
type: :development
|
54
56
|
version_requirements: *id001
|
55
57
|
- !ruby/object:Gem::Dependency
|
@@ -60,11 +62,12 @@ dependencies:
|
|
60
62
|
requirements:
|
61
63
|
- - ">="
|
62
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 19
|
63
66
|
segments:
|
64
67
|
- 2
|
65
|
-
-
|
68
|
+
- 7
|
66
69
|
- 0
|
67
|
-
version: 2.
|
70
|
+
version: 2.7.0
|
68
71
|
type: :development
|
69
72
|
version_requirements: *id002
|
70
73
|
description: |-
|
@@ -104,6 +107,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
107
|
requirements:
|
105
108
|
- - ">="
|
106
109
|
- !ruby/object:Gem::Version
|
110
|
+
hash: 3
|
107
111
|
segments:
|
108
112
|
- 0
|
109
113
|
version: "0"
|
@@ -112,6 +116,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
116
|
requirements:
|
113
117
|
- - ">="
|
114
118
|
- !ruby/object:Gem::Version
|
119
|
+
hash: 3
|
115
120
|
segments:
|
116
121
|
- 0
|
117
122
|
version: "0"
|
metadata.gz.sig
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
-
|
2
|
-
��
|
3
|
-
|
1
|
+
��?oW���C�bS�e��ʀj�k��7��K�k���J��e'"D?s^(��78�0a�N�;���W�&^Vm/MZ|tu��*����������9<D���H�Aq����l2Cmˋ1
|
2
|
+
��5]���Wv�a��f@T_}�<��H���=^\������/n���|=Z�ƈ��bޞ:
|
3
|
+
��++q�9i�Hx
|
4
|
+
Jx�06�|-���R!WK�)W(7��S�&�Y��q���}��
|