cookie_http_client 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cookie_http_client.rb +8 -4
- data/lib/cookie_http_client/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4255fcb661dc7f7ffc9c839e993370067c5198dd
|
4
|
+
data.tar.gz: c0a8fd671c65cc10ca8efac44396ee05a9d884c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 054ba146adac81bf562bdf74309b0bf23316bc5b5ca92907f8298a449ac42ba0728d063422a54abf830f62a976a0da37209c001d382f8ca154d1216a03d8df50
|
7
|
+
data.tar.gz: 5a4c5fc58265a0e67564ace5bbfdcf47ece75b88c6de1ed9b02ca3b67591f3d675256acb7cebf84774978124699deb05ad6ed2326ed37966273534987cd0b668
|
data/lib/cookie_http_client.rb
CHANGED
@@ -9,10 +9,13 @@ class CookieHTTPClient
|
|
9
9
|
THIS = CookieHTTPClient
|
10
10
|
class HTTPFound < Exception
|
11
11
|
attr_reader :redirect_uri, :source
|
12
|
-
def initialize(httpFound)
|
12
|
+
def initialize(httpFound, uri)
|
13
13
|
@source = httpFound
|
14
|
-
|
15
|
-
|
14
|
+
r = URI.parse(httpFound['location'])
|
15
|
+
r.path = '/' if r.path.empty?
|
16
|
+
r.scheme = uri.scheme unless r.scheme
|
17
|
+
r.host = uri.host unless r.host
|
18
|
+
@redirect_uri = URI.parse(r.to_s)
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
@@ -48,7 +51,7 @@ protected
|
|
48
51
|
h["Cookie"] = c unless c.empty?
|
49
52
|
r = yield(http, path, h)
|
50
53
|
@@cookie_jar.set_cookie(r['set-cookie'], uri)
|
51
|
-
raise HTTPFound.new(r) if r.is_a? Net::HTTPFound or r.is_a? Net::HTTPMovedPermanently
|
54
|
+
raise HTTPFound.new(r, uri) if r.is_a? Net::HTTPFound or r.is_a? Net::HTTPMovedPermanently
|
52
55
|
r
|
53
56
|
end
|
54
57
|
|
@@ -95,6 +98,7 @@ public
|
|
95
98
|
# @return Net::HTTPResponse
|
96
99
|
def post(data, header={}, &block)
|
97
100
|
begin
|
101
|
+
@last_uri = @uri
|
98
102
|
request(@uri, header){|http, path, header2|
|
99
103
|
http.post(path, data, header2)
|
100
104
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cookie_http_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Toshiyuki Suzumura
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|