Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[BUG/PATCH] http-access2

1 view
Skip to first unread message

Ara.T.Howard

unread,
Nov 3, 2005, 10:13:05 PM11/3/05
to

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
===============================================================================

tran...@gmail.com

unread,
Jul 17, 2006, 6:06:24 AM7/17/06
to

NAKAMURA, Hiroshi wrote:
> Sorry for very late reply.

>
> Ara.T.Howard wrote:
> > here's a patch for a bug that causes cookies using http-access2 not to
> > be sent
> > on subsequent requests:
>
> 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.


NAKAMURA, Hiroshi

unread,
Jul 17, 2006, 10:03:29 AM7/17/06
to
Hi,

tran...@gmail.com wrote:
> 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

Trans

unread,
Jul 18, 2006, 8:06:58 AM7/18/06
to

NAKAMURA, Hiroshi wrote:
> Hi,
>
> tran...@gmail.com wrote:
> > 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.

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?

> > 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...

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

regards,
T.

tran...@gmail.com

unread,
Jul 22, 2006, 8:21:09 AM7/22/06
to

NAKAMURA, Hiroshi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi,

>
> Trans wrote:
> >> 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 ?
>
> 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..

> > But maybe just use HTTP namespace? HttpClient = HTTP::Client?
>

> 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.


0 new messages