Mechanize v2.1 Release Notes

Release Date: 2011-12-20 // over 12 years ago
    • ๐Ÿ—„ Deprecations

      • Mechanize#get no longer accepts an options hash.
      • Mechanize::Util::to_native_charset has been removed.
    • Minor enhancements

      • Mechanize now depends on net-http-persistent 2.3+. This new version brings idle timeouts to help with the dreaded "too many connection resets" issue when POSTing to a closed connection. Issue #123
      • SSL connections will be verified against the system certificate store by default.
      • Added Mechanize#retry_change_requests to allow mechanize to retry POST and other non-idempotent requests when you know it is safe to do so. Issue #123
      • Mechanize can now stream files directly to disk without loading them into memory first through Mechanize::Download, a pluggable parser for downloading files.

      All responses larger than Mechanize#max_file_buffer are downloaded to a Tempfile. For backwards compatibility Mechanize::File subclasses still load the response body into memory.

      To force all unknown content types to download to disk instead of memory set:

      agent.pluggable_parser.default = Mechanize::Download

      • Added Mechanize#content_encoding_hooks which allow handling of non-standard content encodings like "agzip". Patch #125 by kitamomonga
      • Added dom_class to elements and the element matcher like dom_id. Patch #156 by Dan Hansen.
      • Added support for the HTML5 keygen form element. See http://dev.w3.org/html5/spec/Overview.html#the-keygen-element Patch #157 by Victor Costan.
      • Mechanize no longer follows meta refreshes that have no "url=" in the content attribute to avoid infinite loops. To follow a meta refresh to the same page set Mechanize#follow_meta_refresh_self to true. Issue #134 by Jo Hund.
      • Updated 'Mac Safari' User-Agent alias to Safari 5.1.1. 'Mac Safari 4' can be used for the old 'Mac Safari' alias.
      • When given multiple HTTP authentication options mechanize now picks the strongest method.
      • Improvements to HTTP authorization:
      • mechanize raises Mechanize::UnathorizedError for 401 responses which is a sublcass of Mechanize::ResponseCodeError.
      • Added support for NTLM authentication, but this has not been tested.
      • Mechanize::Cookie.new accepts attributes in a hash.
      • Mechanize::CookieJar#<<(cookie) (alias: add!) is added. Issue #139
      • Different mechanize instances may now have different loggers. Issue #122
      • Mechanize now accepts a proxy port as a service name or number string. Issue #167
    • ๐Ÿ› Bug fixes

      • Mechanize now handles cookies just as most modern browsers do, roughly based on RFC 6265.
      • domain=.example.com (which is invalid) is considered identical to domain=example.com.
      • A cookie with domain=example.com is sent to host.sub.example.com as well as host.example.com and example.com.
      • A cookie with domain=TLD (no dots) is accepted and sent if the host name is TLD, and rejected otherwise. To retain compatibility and convention, host/domain names starting with "local" are exempt from this rule.
      • A cookie with no domain attribute is only sent to the original host.
      • A cookie with an Effective TLD is rejected based on the public suffix list. (cf. http://publicsuffix.org/)
      • "Secure" cookies are not sent via non-https connection.
      • Subdomain match is not performed against an IP address.
      • It is recommended that you clear out existing cookie jars for regeneration because previously saved cookies may not have been parsed correctly.
      • Mechanize takes more care to avoid saving files with certain unsafe names. You should still take care not to use mechanize to save files directly into your home directory ($HOME). Issue #163.
      • Mechanize#cookie_jar= works again. Issue #126
      • The original Referer value persists on redirection. Issue #150
      • Do not send a referer on a Refresh header based redirection.
      • Fixed encoding error in tests when LANG=C. Patch #142 by jinschoi.
      • The order of items in a form submission now match the DOM order. Patch #129 by kitamomonga
      • Fixed proxy example in EXAMPLE. Issue #146 by NielsKSchjoedt