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 CHANGED
Binary file
data/History.txt CHANGED
@@ -1,6 +1,11 @@
1
+ === 0.1 / 2010-12-07
2
+
3
+ * Minor enhancement
4
+ * Add 1.8.7 support
5
+
1
6
  === 0.0 / 2010-12-07
2
7
 
3
- * 1 major enhancement
8
+ * Major enhancement
4
9
 
5
10
  * Birthday!
6
11
 
data/README.txt CHANGED
@@ -13,7 +13,6 @@ proof of concept.
13
13
  * Provides HTTP/1.1 pipelining
14
14
  * Does not implement request wrangling per RFC 2616 8.1.2.2
15
15
  * Does not handle errors
16
- * May not work on Ruby 1.8, untested
17
16
 
18
17
  == SYNOPSIS:
19
18
 
@@ -24,7 +24,7 @@ require 'net/http'
24
24
 
25
25
  module Net::HTTP::Pipeline
26
26
 
27
- VERSION = '0.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
- # Checks for an connection close header
86
+ if Net::HTTPResponse.allocate.respond_to? :connection_close? then
87
+ ##
88
+ # Checks for an connection close header
88
89
 
89
- def pipeline_keep_alive? res
90
- not res.connection_close?
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 "test/unit"
1
+ require 'minitest/autorun'
2
2
  require 'net/http/pipeline'
3
3
  require 'stringio'
4
4
 
5
- class TestNetHttpPipeline < Test::Unit::TestCase
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 = <<-EXPECTED
109
- GET / HTTP/1.1\r
110
- Accept: */*\r
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
- - 0
8
- version: "0.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
- - 2
50
- - 0
51
+ - 1
52
+ - 5
51
53
  - 0
52
- version: 2.0.0
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
- - 6
68
+ - 7
66
69
  - 0
67
- version: 2.6.0
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
- 0�@�
2
- ��c� 8TU�Mׅ�Ͻ�����\9��=�W����}l����_$����� �Q��}JBV*��4�`��Rʴ0u�uzw�]����^}'¦#�I^(U`�0��q|�����?0�t�P �Iz%ѵ��H�;=�����Hfw: �O��Iחn�\A�F��J�w* �h=��4L4g�NI�>y�� m�o��?�7����y��et2�,-��-�AL"_;I�<b�P�)���K�
3
- R��ˍ�r5��xx
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
+ ��++q9i�Hx
4
+ Jx�06�|-���R!WK�)W(7��S�&�Y��q���} ��