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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0ff55f1850c78b28d1384b7f8f2fed0b2ac85cfb
4
- data.tar.gz: 1d68442de8c882aad981235cdc44fea36d00dcad
3
+ metadata.gz: 4255fcb661dc7f7ffc9c839e993370067c5198dd
4
+ data.tar.gz: c0a8fd671c65cc10ca8efac44396ee05a9d884c2
5
5
  SHA512:
6
- metadata.gz: 66e8bdf23882505215f37a25a3913552f8c349136fd940df1077fbbf74f3a5b58063f5bb59f08bc945be3fe52988d8f1ffe85e7d81975cc073ff620923e4c31c
7
- data.tar.gz: 30298cf2bf8725597c60c212980a934b51c41dbe03b5e4c13a69c4e40f0323ac8389132a160de0de99f8a2ef9893fe17df76ec34f630a15b1bf0deeef3d27b78
6
+ metadata.gz: 054ba146adac81bf562bdf74309b0bf23316bc5b5ca92907f8298a449ac42ba0728d063422a54abf830f62a976a0da37209c001d382f8ca154d1216a03d8df50
7
+ data.tar.gz: 5a4c5fc58265a0e67564ace5bbfdcf47ece75b88c6de1ed9b02ca3b67591f3d675256acb7cebf84774978124699deb05ad6ed2326ed37966273534987cd0b668
@@ -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
- @redirect_uri = URI.parse(httpFound['location'])
15
- @redirect_uri.path = '/' if @redirect_uri.path.empty?
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
  }
@@ -1,3 +1,3 @@
1
1
  class CookieHTTPClient
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
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.2
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-03 00:00:00.000000000 Z
11
+ date: 2015-04-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler