sparklemotion / mechanize

Mechanize is a ruby library that makes automated web interaction easy.
https://www.rubydoc.info/gems/mechanize/
MIT License
4.39k stars 473 forks source link

NoMethodError from agent.rb:648 #420

Closed committance closed 7 years ago

committance commented 9 years ago

Hi, This code

require 'mechanize' agent = Mechanize.new

agent.keep_alive = false agent.open_timeout = 2 agent.read_timeout = 2 agent.ignore_bad_chunking = true agent.gzip_enabled = false

url = 'http:%5C%5Cwww.scouts.org.uk'

agent.head(url)

leads to thi Error:

~/.rvm/gems/ruby-head/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:648:in resolve': undefined methodlength' for nil:NilClass (NoMethodError)

from ~/.rvm/gems/ruby-head/gems/mechanize-2.7.3/lib/mechanize/http/agent.rb:223:in `fetch'
from ~/.rvm/gems/ruby-head/gems/mechanize-2.7.3/lib/mechanize.rb:459:in `head

I'm running mecahnize 2.7.3 and ruby 2.3.0dev. Will it be fixed?

hugolepetit commented 7 years ago

%5C is the escape code for backslash, not forward slash. This is not a bug, maintainers might want to close this

knu commented 7 years ago

Thanks, I fixed it so it would raise ArgumentError instead.