[Mechanize-users] handling protocol violations

Aaron Patterson aaron_patterson at speakeasy.net
Mon Nov 13 18:11:46 EST 2006

Hi Eduardo,

On Mon, Nov 13, 2006 at 10:37:16PM +0100, Eduardo Fernandez Corrales wrote:
> Hello,
> I have found a webserver that spits the cookie version as a float
> (1.2) instead of an integer as the protocol mandates.
> (www.alimentacion.carrefour.es)
> So far I have been changing line 33 in cookie.rb from
> when "version" then cookie.version = Integer(value)
> to
> when "version" then cookie.version = Integer(value.round)
> Of course every time WWW:Mechanize gets updated, I have to do the change again.
> How should we handle this? I am sure there has to be a better way.

Mechanize should handle this malformed header without blowing up.  I'll
set the version to nil when it is invalid and send a warning message to
the logger.

> Thank you very much, I am really having fun using this fine piece of software.
> -- 
> Eduardo Fernández Corrales || 0xEFC.com
> _______________________________________________
> Mechanize-users mailing list
> Mechanize-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/mechanize-users

Aaron Patterson

More information about the Mechanize-users mailing list