#187 ✓resolved
Mark Menard

Mechanize Session Created for each HTTP Request

Reported by Mark Menard | March 6th, 2009 @ 10:20 AM

When using the Mechanize support each request to get a page creates a new instance of WWW::Mechanize. This means that cookies are not preserved. Without cookies lots of stuff doesn't work.

I posted a pull request on Git Hub with a patch. All I did was memoize the WWW::Mechanize instance variable with the ||= operator at line 39 in mechanize.rb.

Comments and changes to this ticket

  • Mark Menard

    Mark Menard March 31st, 2009 @ 02:12 PM

    • Tag set to bugfix, patch
  • gaffo

    gaffo May 7th, 2009 @ 05:09 PM

    • Tag changed from bugfix, patch to bugfix, patch, verify
    • State changed from “new” to “awaiting-merge”

    It's a pseudo patch, I'm not sure if it's good or not and there are no tests.

  • Bryan Helmkamp

    Bryan Helmkamp June 14th, 2009 @ 09:09 PM

    • State changed from “awaiting-merge” to “resolved”

    Thanks, Mark and Andres. I believe this is resolved in the latest Webrat, as the code looks like this:

        def mechanize
          @mechanize ||= WWW::Mechanize.new
        end
    

    Marking this as resolved, but please re-open if there are further issues that need attention.

    Cheers,

    -Bryan

  • Alex Chaffee

    Alex Chaffee October 13th, 2009 @ 07:50 PM

    And make sure to "gem uninstall brynary-webrat" or else your old version of "brynary-webrat" will override the new version of "webrat" -- since B comes before W!

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Ruby Acceptance Testing for Web applications.

Shared Ticket Bins

People watching this ticket

Pages