Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't modify a frozen object in SSL resolver.
Sometimes it happens that when submitting forms under https://, I get a crash because WWW::Mechanize::Chain::SSLResolver tries to change its connection and the connection is frozen: TypeError: can't modify frozen object from /usr/lib/ruby/1.8/net/https.rb:138:in `verify_mode=' from /usr/lib/ruby/1.8/net/https.rb:138:in `verify_mode=' from ./lib/www/mechanize/chain/ssl_resolver.rb:20:in `handle' from ./lib/www/mechanize/chain.rb:30:in `pass' from ./lib/www/mechanize/chain/handler.rb:6:in `handle' from ./lib/www/mechanize/chain/connection_resolver.rb:73:in `handle' from ./lib/www/mechanize/chain.rb:30:in `pass' from ./lib/www/mechanize/chain/handler.rb:6:in `handle' from ./lib/www/mechanize/chain/request_resolver.rb:27:in `handle' from ./lib/www/mechanize/chain.rb:30:in `pass' from ./lib/www/mechanize/chain/handler.rb:6:in `handle' from ./lib/www/mechanize/chain/parameter_resolver.rb:18:in `handle' from ./lib/www/mechanize/chain.rb:30:in `pass' from ./lib/www/mechanize/chain/handler.rb:6:in `handle' from ./lib/www/mechanize/chain/uri_resolver.rb:51:in `handle' from ./lib/www/mechanize/chain.rb:25:in `handle' from ./lib/www/mechanize.rb:434:in `fetch_page' from ./lib/www/mechanize.rb:393:in `post_form' from ./lib/www/mechanize.rb:325:in `submit'
- Loading branch information
88762d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still experience this error sometimes using the latest version of Mechanize (0.9.0) which includes this fix.
I can’t reproduce this bug in a reliable way but I was thinking maybe the line
causes the object to freeze. Although I looked in the source of the net/https and did not find any reference to the object being frozen.
88762d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still experience this error sometimes using the latest version of Mechanize (0.9.0) which includes this fix.
I can’t reproduce this bug in a reliable way but I was thinking maybe the line
causes the object to freeze. Although I looked in the source of the net/https and did not find any reference to the object being frozen.
88762d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try setting keep_alive to false when initializing Mechanize Agent
88762d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent.keep_alive = false worked for me, when even updating to 0.9.0 failed after multiple requests. (Like 30 or so of 600)
88762d4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agent.keep_alive didnt work for me. IT works in my mac osx but not in CENTOS 5.3