httpclient 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/httpclient.rb +29 -18
- data/lib/httpclient.rb.orig +1020 -0
- data/lib/httpclient/auth.rb +20 -8
- data/lib/httpclient/auth.rb.orig +513 -0
- data/lib/httpclient/cacert.p7s +670 -30
- data/lib/httpclient/cookie.rb +3 -1
- data/lib/httpclient/http.rb +8 -4
- data/lib/httpclient/session.rb +12 -4
- data/lib/httpclient/ssl_config.rb +22 -17
- metadata +4 -2
data/lib/httpclient/cookie.rb
CHANGED
@@ -160,8 +160,10 @@ class WebAgent
|
|
160
160
|
|
161
161
|
def parse(str, url)
|
162
162
|
@url = url
|
163
|
+
# TODO: should not depend on join_quotedstr. scan with escape like CSV.
|
163
164
|
cookie_elem = str.split(/;/)
|
164
165
|
cookie_elem = join_quotedstr(cookie_elem, ';')
|
166
|
+
cookie_elem -= [""] # del empty elements, a cookie might included ";;"
|
165
167
|
first_elem = cookie_elem.shift
|
166
168
|
if first_elem !~ /([^=]*)(\=(.*))?/
|
167
169
|
return
|
@@ -170,7 +172,7 @@ class WebAgent
|
|
170
172
|
@name = $1.strip
|
171
173
|
@value = normalize_cookie_value($3)
|
172
174
|
cookie_elem.each{|pair|
|
173
|
-
key, value = pair.split(
|
175
|
+
key, value = pair.split(/=/, 2) ## value may nil
|
174
176
|
key.strip!
|
175
177
|
value = normalize_cookie_value(value)
|
176
178
|
case key.downcase
|
data/lib/httpclient/http.rb
CHANGED
@@ -320,7 +320,7 @@ module HTTP
|
|
320
320
|
end
|
321
321
|
if @chunked
|
322
322
|
set('Transfer-Encoding', 'chunked')
|
323
|
-
elsif keep_alive or @body_size != 0
|
323
|
+
elsif @body_size and (keep_alive or @body_size != 0)
|
324
324
|
set('Content-Length', @body_size.to_s)
|
325
325
|
end
|
326
326
|
if @http_version >= 1.1
|
@@ -623,7 +623,7 @@ module HTTP
|
|
623
623
|
def new_connect_request(uri)
|
624
624
|
m = new
|
625
625
|
m.header.init_connect_request(uri)
|
626
|
-
m.header.body_size =
|
626
|
+
m.header.body_size = nil
|
627
627
|
m
|
628
628
|
end
|
629
629
|
|
@@ -645,8 +645,12 @@ module HTTP
|
|
645
645
|
m.header.init_request(method, uri, query)
|
646
646
|
m.body = Body.new
|
647
647
|
m.body.init_request(body || '', boundary)
|
648
|
-
|
649
|
-
|
648
|
+
if body
|
649
|
+
m.header.body_size = m.body.size
|
650
|
+
m.header.chunked = true if m.body.size.nil?
|
651
|
+
else
|
652
|
+
m.header.body_size = nil
|
653
|
+
end
|
650
654
|
m
|
651
655
|
end
|
652
656
|
|
data/lib/httpclient/session.rb
CHANGED
@@ -445,7 +445,7 @@ class HTTPClient
|
|
445
445
|
include SocketWrap
|
446
446
|
|
447
447
|
def initialize(host, port, response)
|
448
|
-
super(StringIO.new(response))
|
448
|
+
super(response.is_a?(StringIO) ? response : StringIO.new(response))
|
449
449
|
@host = host
|
450
450
|
@port = port
|
451
451
|
end
|
@@ -800,9 +800,13 @@ class HTTPClient
|
|
800
800
|
maxbytes = @read_block_size
|
801
801
|
maxbytes = @content_length if maxbytes > @content_length
|
802
802
|
timeout(@receive_timeout, ReceiveTimeoutError) do
|
803
|
-
|
803
|
+
begin
|
804
|
+
@socket.readpartial(maxbytes, buf)
|
805
|
+
rescue EOFError
|
806
|
+
buf = nil
|
807
|
+
end
|
804
808
|
end
|
805
|
-
if buf.length > 0
|
809
|
+
if buf && buf.length > 0
|
806
810
|
@content_length -= buf.length
|
807
811
|
yield buf
|
808
812
|
else
|
@@ -840,7 +844,11 @@ class HTTPClient
|
|
840
844
|
buf = ''
|
841
845
|
while true
|
842
846
|
timeout(@receive_timeout, ReceiveTimeoutError) do
|
843
|
-
|
847
|
+
begin
|
848
|
+
@socket.readpartial(@read_block_size, buf)
|
849
|
+
rescue EOFError
|
850
|
+
buf = nil
|
851
|
+
end
|
844
852
|
end
|
845
853
|
if buf && buf.length > 0
|
846
854
|
yield buf
|
@@ -343,23 +343,28 @@ class HTTPClient
|
|
343
343
|
if File.exist?(file)
|
344
344
|
dist_cert =<<__DIST_CERT__
|
345
345
|
-----BEGIN CERTIFICATE-----
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
346
|
+
MIID/TCCAuWgAwIBAgIBATANBgkqhkiG9w0BAQ0FADBLMQswCQYDVQQGEwJKUDER
|
347
|
+
MA8GA1UECgwIY3Rvci5vcmcxFDASBgNVBAsMC0RldmVsb3BtZW50MRMwEQYDVQQD
|
348
|
+
DApodHRwY2xpZW50MB4XDTA5MDUyMTEyMzkwNVoXDTM3MTIzMTIzNTk1OVowSzEL
|
349
|
+
MAkGA1UEBhMCSlAxETAPBgNVBAoMCGN0b3Iub3JnMRQwEgYDVQQLDAtEZXZlbG9w
|
350
|
+
bWVudDETMBEGA1UEAwwKaHR0cGNsaWVudDCCASIwDQYJKoZIhvcNAQEBBQADggEP
|
351
|
+
ADCCAQoCggEBAM2PlkdTH97zvIHoPIMj87wnNvpqIQUD7L/hlysO0XBsmR/XZUeU
|
352
|
+
ZKB10JQqMXviWpTnU9KU6xGTx3EI4wfd2dpLwH/d4d7K4LngW1kY7kJlZeJhakno
|
353
|
+
GzQ40RSI9WkQ0R9KOE888f7OkTBafcL8UyWFVIMhQBw2d9iNl4Jc69QojayCDoSX
|
354
|
+
XbbEP0n8yi7HwIU3RFuX6DtMpOx4/1K7Z002ccOGJ3J9kHgeDQSQtF42cQYC7qj2
|
355
|
+
67I/OQgnB7ycxTCP0E7bdXQg+zqsngrhaoNn/+I+CoO7nD4t4uQ+B4agALh4PPxs
|
356
|
+
bQD9MCL+VurNGLYv0HVd+ZlLblpddC9PLTsCAwEAAaOB6zCB6DAPBgNVHRMBAf8E
|
357
|
+
BTADAQH/MDEGCWCGSAGG+EIBDQQkFiJSdWJ5L09wZW5TU0wgR2VuZXJhdGVkIENl
|
358
|
+
cnRpZmljYXRlMB0GA1UdDgQWBBRAnB6XlMoOcm7HVAw+JWxY205PHTAOBgNVHQ8B
|
359
|
+
Af8EBAMCAQYwcwYDVR0jBGwwaoAUQJwel5TKDnJux1QMPiVsWNtOTx2hT6RNMEsx
|
360
|
+
CzAJBgNVBAYTAkpQMREwDwYDVQQKDAhjdG9yLm9yZzEUMBIGA1UECwwLRGV2ZWxv
|
361
|
+
cG1lbnQxEzARBgNVBAMMCmh0dHBjbGllbnSCAQEwDQYJKoZIhvcNAQENBQADggEB
|
362
|
+
ABVFepybD5XqsBnOn/oDHvK0xAPMF4Ap4Ht1yMQLObg8paVhANSdqIevPlCr/mPL
|
363
|
+
DRjcy+J1fCnE6lCfsfLdTgAjirqt8pm92NccxmJ8hTmMd3LWC1n+eYWaolqTCVRM
|
364
|
+
Bpe8UY9enyXrFoudHlr9epr18E6As6VrCSfpXFZkD9WHVSWpzkB3qATu5qcDCzCH
|
365
|
+
bI0755Mdm/1hKJCD4l69h3J3OhRIEUPJfHnPvM5wtiyC2dcE9itwE/wdVzBJeIBX
|
366
|
+
JQm+Qj+K8qXcRTzZZGIBjw2n46xJgW6YncNCHU/WWfNCYwdkngHS/aN8IbEjhCwf
|
367
|
+
viXFisVrDN/+pZZGMf67ZaY=
|
363
368
|
-----END CERTIFICATE-----
|
364
369
|
__DIST_CERT__
|
365
370
|
p7 = PKCS7.read_smime(File.open(file) { |f| f.read })
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: httpclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- NAKAMURA, Hiroshi
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-
|
12
|
+
date: 2009-05-25 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,9 +35,11 @@ files:
|
|
35
35
|
- lib/httpclient/ssl_config.rb
|
36
36
|
- lib/httpclient/timeout.rb
|
37
37
|
- lib/httpclient/cookie.rb
|
38
|
+
- lib/httpclient/auth.rb.orig
|
38
39
|
- lib/httpclient/cacert.p7s
|
39
40
|
- lib/httpclient.rb
|
40
41
|
- lib/http-access2.rb
|
42
|
+
- lib/httpclient.rb.orig
|
41
43
|
has_rdoc: true
|
42
44
|
homepage: http://dev.ctor.org/httpclient
|
43
45
|
post_install_message:
|