Displaying 2 results from an estimated 2 matches for "res_klass".
2007 Oct 05
3
basic_auth problem since 0.6.9
I have a site that I don''t think "returns" a basic_auth request, but is
able to use basic_auth.
In the past on 0.6.8, I could use the following code:
require ''rubygems''
# gem ''mechanize'', ''=0.6.8''
require ''mechanize''
agent = WWW::Mechanize.new
agent.basic_auth("username", "password")
2008 May 03
0
marshalling mechanized
...9;'t dump TCPSocket".
basically, don''t try to marshal a socket.
however, if we make sure to finish the http connection after each use,
then the agent can be marshalled safely. i accomplished this by
inserting:
http_obj.finish
immediately prior to this line:
return page if res_klass <= Net::HTTPSuccess
in mechanize.rb, which is approximately line 587 in v 0.7.0
this is a crude hack that doesn''t, i think, respect keep-alive
connections, but it does at least work for the purpose of ensuring the
agent can be marshalled. i invite thoughts on more elegant solutions!
n...