[BUG/PATCH] http-access2

A

Ara.T.Howard

here's a patch for a bug that causes cookies using http-access2 not to be sent
on subsequent requests:

[ahoward@localhost ~]$ cat a.rb
require "http-access2"

cm = WebAgent::CookieManager::new "cookies"
cm.load_cookies
cookie = cm.cookies.first
url = cookie.url

matches = cookie.domain_match url.host, cookie.domain
puts "domain_match('#{ url.host }', '#{ cookie.domain }') => #{ matches }"

module WebAgent::CookieUtils
def domain_match(host, domain)
case domain
when /\d+\.\d+\.\d+\.\d+/
return (host == domain)
when '.'
return true
when /^\./
#return tail_match?(domain, host)
return tail_match?(host, domain)
else
return (host == domain)
end
end
end

matches = cookie.domain_match url.host, cookie.domain
puts "domain_match('#{ url.host }', '#{ cookie.domain }') => #{ matches }"

[ahoward@localhost ~]$ cat cookies
http://rubyforge.org//account/login.php session_ser LjEwMy45Ni40Ni0q%2A-fa0537de8cc31 1131676286 .rubyforge.org / 13

[ahoward@localhost ~]$ ruby a.rb
domain_match('rubyforge.org', '.rubyforge.org') => false
domain_match('rubyforge.org', '.rubyforge.org') => true


without this fix cookies do not round trip as they are not found by
Cookie#find.

regards.

-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| anything that contradicts experience and logic should be abandoned.
| -- h.h. the 14th dalai lama
===============================================================================
 
T

transfire

Sorry for very late reply.



Thank you for detailed explanation. Now I'm planning new http-access
release. I applied your fix.

All, would you please try the following http-access2 preview release at
your leisure?
http://dev.ctor.org/download/http-access-20060717.tar.gz

I want to be sure that this release fixes bugs and does not break user
applications.

Hi,

I would like to encourage you to drop the "2" from the package name. Is
there a "1" and is "1" in common use? Also I encourage you to move
Cookie out of WebAgent namespace since it is no longer part of the
TAKAHASHI `Maki' Masayoshi's WebAgent program.

Thanks for excellent lib!
T.
 
N

NAKAMURA, Hiroshi

Hi,

I would like to encourage you to drop the "2" from the package name. Is
there a "1" and is "1" in common use? Also I encourage you to move

There was "http-access" package by Maehashi-san. Unfortunately the
author terminated(?) it. Net::HTTP and http-access2 were children of
the package. As far as I know Net::HTTP was almost rewritten but
http-access2 still contains HTTP/1.1 parsing state machine of http-access.

Aside from this, I'll change package name and class name if I find a
good name. What do you think "SOAP::HTTPClient"? :)
Cookie out of WebAgent namespace since it is no longer part of the
TAKAHASHI `Maki' Masayoshi's WebAgent program.

I just applied patches from users to WebAgent::Cookie. I almost did
nothing. But I agree with you its module name should be changed. If I
find a good name...

Regards,
// NaHi
 
T

Trans

Hi,



There was "http-access" package by Maehashi-san. Unfortunately the
author terminated(?) it. Net::HTTP and http-access2 were children of
the package. As far as I know Net::HTTP was almost rewritten but
http-access2 still contains HTTP/1.1 parsing state machine of http-access.

I see. Thanks.

Well, I'm no expert on these matters, but...
Aside from this, I'll change package name and class name if I find a
good name. What do you think "SOAP::HTTPClient"? :)

SOAP? More like REST::HTTPClient ?

But maybe just use HTTP namespace? HttpClient = HTTP::Client?
I just applied patches from users to WebAgent::Cookie. I almost did
nothing. But I agree with you its module name should be changed. If I
find a good name...

I definitely think HTTP::Cookie in this case is appropraite.

regards,
T.
 
T

transfire

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,


Users seem to use http-access2 for (1)soap4r or (2)HTTP-Cookies
handling. Don't you think it's unrestful? :)

Huh. Like I said I'm no expert. I didn't realize you could use it like
that. I use it to build a sort-of web-api to Rubyforge. I thought REST
b/c of that --no SOAP envelopes involved..
Hmm. Too generic I think. Implementing HTTP protocol is preserved for
Net::HTTP. Handling HTTP resources is for open-uri. I hope
http-access2 used for creating HTTP client agent.

HTTP::API -> HTTPAPI -> HTPAPPY -> HitPappy ;)

T.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top