diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-13 13:25:51 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-09-13 13:25:51 +0000 |
commit | 033504340d0c9b28fabd2564b0122edaac2aef2e (patch) | |
tree | baa644355f98bbca2812279962edd03859e7daec /lib/rbot | |
parent | 4bed2894ee2cefee3a748ce0bab63dd9ec0bd915 (diff) |
httputil: primitve cookie support
If a redirection sets a cookie, set the cookie in the redirected request
Diffstat (limited to 'lib/rbot')
-rw-r--r-- | lib/rbot/core/utils/httputil.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/rbot/core/utils/httputil.rb b/lib/rbot/core/utils/httputil.rb index f1976b5e..3a267da1 100644 --- a/lib/rbot/core/utils/httputil.rb +++ b/lib/rbot/core/utils/httputil.rb @@ -389,6 +389,11 @@ class HttpUtil when :post, :"net::http::post" new_opts[:method] = :get end + if resp['set-cookie'] + debug "setting cookie #{resp['set-cookie']}" + new_opts[:headers] ||= Hash.new + new_opts[:headers]['Cookie'] = resp['set-cookie'] + end debug "following the redirect to #{new_loc}" return get_response(new_loc, new_opts, &block) else |