Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bad URI(is not URI?) #9

Open
syewell opened this issue Feb 12, 2013 · 4 comments
Open

bad URI(is not URI?) #9

syewell opened this issue Feb 12, 2013 · 4 comments

Comments

@syewell
Copy link

syewell commented Feb 12, 2013

Hi David,

I'm trying to use tourbus for some performance testing but am running into the following error :

2013-02-10 23:39:42 Runner #1: bad URI(is not URI?): %257B:url=%253E%2522http://localhost:3000/%2522,%2520:headers=%253Enil%257D

My tourist class is as follows:

class Simple < Tourist
def tour_home
visit "http://localhost:3000"
assert_contain "Log In"
end
end

If this is a config error on my side I apologize, I'm working on sanding down my n00b edges!

Thanks,

Scott

@xunker
Copy link
Collaborator

xunker commented Feb 12, 2013

I'm having the same issue, researching it. It appears to be an encoding/decoding issue. This is interesting:

1.9.3-p327 :031 > URI::decode("%257B:url=%253E%2522http://localhost:3000/%2522,%2520:headers=%253Enil%257D")
 => "%7B:url=%3E%22http://localhost:3000/%22,%20:headers=%3Enil%7D" 
1.9.3-p327 :032 > URI::decode("%7B:url=%3E%22http://localhost:3000/%22,%20:headers=%3Enil%7D")
  => "{:url=>\"http://localhost:3000/\", :headers=>nil}" 

..It appears that something is being URL-encoded twice before being passed to mechanize. Not sure why, but this s a start.

@xunker
Copy link
Collaborator

xunker commented Feb 12, 2013

Ok, I found the root of the issue. The gemspec requires "mechanize" version >= 1.0.0. The current version of "mechanize" is 2.5.x and the the syntax of the "get" method has changed from 1.0.0 to now.

The tourbus gemspec should probably use "~> 1.0.0" instead of "=> 1.0.0", or patch the code to use the newer version of mechanize.

There is a work-around that I have found:

uninstall the the mechanize gem, and then explicitly install the mechanize 1.0.0 gem:

gem install mechanize -v="1.0.0"

@syewell
Copy link
Author

syewell commented Feb 12, 2013

Awesome, thanks for the work around Matt!

Scott

On Feb 12, 2013, at 6:38 PM, Matthew Nielsen [email protected] wrote:

Ok, I found the root of the issue. The gemspec requires "mechanize" version >= 1.0.0. The current version of "mechanize" is 2.5.x and the the syntax of the "get" method has changed from 1.0.0 to now.

The tourbus gemspec should probably use "~> 1.0.0" instead of "=> 1.0.0", or patch the code to use the newer version of mechanize.

There is a work-around that I have found:

uninstall the the mechanize gem, and then explicitly install the mechanize 1.0.0 gem:

gem install mechanize -v="1.0.0"

Reply to this email directly or view it on GitHub.

@bbozo
Copy link

bbozo commented May 5, 2013

Depending on an ancient version of mechanize prevents the ability to include the tourbus in the Gemfile for Rails projects,

I removed the webrat_headers_patch.rb and it works well with mechanize 2.x now, I am not sure what the original monkey patch tried to do though and if any function is lost now - https://github.com/bbozo/tourbus/tree/make_tourbus_compatible_with_mechanize_2 (commit is named funny, it seemed to me that I was fixing webrat compatibility at the time)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants