Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
FakeWeb.register fails with an e-mail address as username
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  3 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Ken Mayer  
View profile  
 More options Jul 2 2009, 10:04 pm
From: Ken Mayer <li...@bitwrangler.com>
Date: Thu, 2 Jul 2009 19:04:20 -0700 (PDT)
Local: Thurs, Jul 2 2009 10:04 pm
Subject: FakeWeb.register fails with an e-mail address as username
This is not really fakeweb's fault, but perhaps there's another way to
handle Basic Auth... If the username is an e-mail address (which is
used more and more frequently, then the Standard Library URI parse
croaks on the URI passed in.

Here's how I reproduce this:

$ gem list -l fakeweb
fakeweb (1.2.4)
r$ irb -rubygems -r fakeweb
irb(main):001:0> FakeWeb.register_uri(:get, "http://
some...@example.org:test@localhost:3000/foobar.html", :body => "")
URI::InvalidURIError: the scheme http does not accept registry part:
some...@example.org:test@localhost:3000 (or bad hostname?)
        from /opt/local/lib/ruby/1.8/uri/generic.rb:195:in `initialize'
        from /opt/local/lib/ruby/1.8/uri/http.rb:78:in `initialize'
        from /opt/local/lib/ruby/1.8/uri/common.rb:488:in `new'
        from /opt/local/lib/ruby/1.8/uri/common.rb:488:in `parse'
        from /opt/local/lib/ruby/gems/1.8/gems/fakeweb-1.2.4/lib/fake_web/
registry.rb:95:in `normalize_uri'
        from /opt/local/lib/ruby/gems/1.8/gems/fakeweb-1.2.4/lib/fake_web/
registry.rb:21:in `register_uri'
        from /opt/local/lib/ruby/gems/1.8/gems/fakeweb-1.2.4/lib/fake_web.rb:
113:in `register_uri'
        from (irb):1


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Chris Kampmeier  
View profile  
 More options Jul 3 2009, 2:49 am
From: Chris Kampmeier <ch...@kampers.net>
Date: Thu, 2 Jul 2009 23:49:31 -0700 (PDT)
Local: Fri, Jul 3 2009 2:49 am
Subject: Re: FakeWeb.register fails with an e-mail address as username
On Jul 2, 10:04 pm, Ken Mayer <li...@bitwrangler.com> wrote:

> This is not really fakeweb's fault, but perhaps there's another way to
> handle Basic Auth... If the username is an e-mail address (which is
> used more and more frequently, then the Standard Library URI parse
> croaks on the URI passed in.

> Here's how I reproduce this:

> $ gem list -l fakeweb
> fakeweb (1.2.4)
> r$ irb -rubygems -r fakeweb
> irb(main):001:0> FakeWeb.register_uri(:get, "http://
> some...@example.org:test@localhost:3000/foobar.html", :body => "")
> URI::InvalidURIError: the scheme http does not accept registry part:
> some...@example.org:test@localhost:3000 (or bad hostname?)

Hey Ken, thanks for posting. I think what you were trying to do is not
quite valid, but I wrote a test for the actual valid approach and it
doesn't work either :) oops. So I just fixed that:
http://github.com/chrisk/fakeweb/commit/1ad638500be9ddd570c6a888e5b34...

Here's what you should do once that's released (in 1.2.5):

# percent-encode unsafe characters in the userinfo part, per RFC 3986
FakeWeb.register_uri(:get, "http://someone
%40example.org:test@localhost:3000/foobar.html", :body => "")

http = Net::HTTP.new("localhost", 3000)
request = Net::HTTP::Get.new("/foobar.html")
request.basic_auth("some...@example.org", "test")  # but no need to
escape here, since it's not a URI
http.request(request)

That should do the trick. I'll try to release 1.2.5 soon -- I need to
refactor the ugly implementation in that commit a bit, and write some
more tests.

Thanks again,
Chris


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Ken Mayer  
View profile  
 More options Jul 3 2009, 4:37 am
From: Ken Mayer <li...@bitwrangler.com>
Date: Thu, 2 Jul 2009 22:37:31 -1000
Local: Fri, Jul 3 2009 4:37 am
Subject: Re: [fakeweb] Re: FakeWeb.register fails with an e-mail address as username
Chris,

Thanks for the update!

Aloha a hui hou,
Ken
--
Ken Mayer / kma...@bitwrangler.com / 808-722-6142 / http://www.bitwrangler.com/

On Jul 2, 2009, at 8:49 PM, Chris Kampmeier wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »