# Does anyone have any small example code on how to use http-a

**URL:** <https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915>\
**Category:** Ruby\
**Created:** [July 9, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915 "2007-07-09T13:58:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![KpKpKp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e79b87/32.png) [@KpKpKp](https://www.ruby-forum.com/u/KpKpKp)\
**Post date:** [July 9, 2007, 1:58pm UTC](https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915/1 "2007-07-09T13:58:58Z")

</div>

Hi,

I’m trying to use the http-access2 gem to perform a basic set of login /  
get  
page operations on a website, from the point of view of checking site  
performance. Since documentation of this library seems to be extremely  
hard  
to find, could someone who has used this library in the past please send  
me  
a basic ‘howto’ of the basic operations?

Precisely what I want to do is:

1. Login to webpage (no https required) by sending username and password  
strings in a POST
2. Get the body of the webpage that loads, also capturing the session  
cookie  
to keep the session alive between requests
3. Send a post to the server that asks for the page to be updated
4. Get the updated page
5. Repeat steps 2, 3 and 4 multiple times
6. Check out on an average how much time it takes for a single page  
reload.

I’d be really grateful if someone could point me along, since this  
library  
seems to have everything I need to get things working, except I can’t  
find  
out how 🙂

Thanks a lot!

Kp.

---

<div class="post-metadata">

**Author:** ![KpKpKp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e79b87/32.png) [@KpKpKp](https://www.ruby-forum.com/u/KpKpKp)\
**Post date:** [July 9, 2007, 4:44pm UTC](https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915/2 "2007-07-09T16:44:13Z")

</div>

On Jul 9, 2007, at 5:56 AM, Kp wrote:

> 1. Check out on an average how much time it takes for a single page  
> Kp.

[http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/](http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/)  
rubyforge

it’s the very first and last parts of this program that are relevant.

regards.

-a

---

<div class="post-metadata">

**Author:** ![KpKpKp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e79b87/32.png) [@KpKpKp](https://www.ruby-forum.com/u/KpKpKp)\
**Post date:** [July 10, 2007, 12:50pm UTC](https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915/3 "2007-07-10T12:50:11Z")

</div>

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

Hi,

Thanks for your interest to http-access2.

ara.t.howard wrote:

> [http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/rubyforge](http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/rubyforge)

I see the “hack to fix http-access2 cookie selection bug” part. I fixed  
it in a later release. Please find how it should be.  
[http://dev.ctor.org/http-access2/browser/trunk/lib/http-access2/cookie.rb#L32](http://dev.ctor.org/http-access2/browser/trunk/lib/http-access2/cookie.rb#L32)

// NaHi

-----BEGIN PGP SIGNATURE-----  
Version: GnuPG v1.4.5 (Cygwin)

iQEVAwUBRpNkPx9L2jg5EEGlAQL6DAf+OirUtm7XA9eZfV/nXRJnSc+U6v+MJTld  
YlY8pOjJN99NsF8fuNdIpa+SzY1uQi6RCDj3IybsKgTjsCNa8aoZMZ9Ord7akVji  
s+e7jGYMaKy4W8EBlT1rwXtHpHjH1Y2pG8oAoJjkHE8pbSzFbHAqGyjkB8T1s1EP  
T9vrEapuZWMS9SnhRIiLpnPC8p2QiAsCyVpAmZoWzLAwkJ5O1ZzIq5rVDsw0OVq6  
XbuDZi9G+0kEMEZP9hrjxOpfEWrZJyeNUwXVgy2HWvWp6tBZQOtK3Nm1SFsvVLbQ  
HDDzcHBWGVSk8Ne839K0/5D1306t47bI68CxN8Oh3AmVQIukc+sQww==  
=M4Pn  
-----END PGP SIGNATURE-----

---

<div class="post-metadata">

**Author:** ![KpKpKp](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/e79b87/32.png) [@KpKpKp](https://www.ruby-forum.com/u/KpKpKp)\
**Post date:** [July 10, 2007, 1:59pm UTC](https://www.ruby-forum.com/t/does-anyone-have-any-small-example-code-on-how-to-use-http-a/108915/4 "2007-07-10T13:59:23Z")

</div>

On 7/10/07, NAKAMURA, Hiroshi [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi,
> 
> Thanks for your interest to http-access2.
> 
> ara.t.howard wrote:
> 
> > [http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/rubyforge](http://codeforpeople.com/lib/ruby/rubyforge/rubyforge-0.1.1/bin/rubyforge)
> 
> I see the “hack to fix http-access2 cookie selection bug” part. I fixed  
> it in a later release. Please find how it should be.  
> [http://dev.ctor.org/http-access2/browser/trunk/lib/http-access2/cookie.rb#L32](http://dev.ctor.org/http-access2/browser/trunk/lib/http-access2/cookie.rb#L32)

There’s a problem with the http-access2 gem docs - there’s a lot of  
documentation that doesn’t seem to be extracted by rdoc. It shows up  
in the comments when I read source, but not in the generated rdoc.

martin
