sshaw / Mojolicious-Plugin-DigestAuth

HTTP Digest Authentication for Mojolicious
1 stars 5 forks source link

Leading slash bug #1

Closed skaurus closed 12 years ago

skaurus commented 12 years ago

$self->_request->url returns url without leading slash, but browser send in "Authorization:" header url WITH leading slash. So here's fix. Provided by https://github.com/gibbon4ik

sshaw commented 12 years ago

Hi, what browser and version of Mojolicious are you using? Do any of the Digest module's test cases fail?

Thanks

skaurus commented 12 years ago

Hi, Recent Firefox, Mojo 2.09 or something. Mojo changed some of its uri methods to not include leading slash sometimes ago, maybe around 1.40-1.50 versions. No, tests didn't fail by this mean... but they fail when machine locale different from English, so error messages in different language too :)

sshaw commented 12 years ago

I think I see a problem, not sure if it's what you're seeing, Given:

use strict;
use warnings;

use Mojolicious::Lite;

plugin 'digest_auth', allow => { sshaw => 'password' };

get '/xxx' => sub { 
    my $self = shift;
    #return unless $self->digest_auth;
    $self->render(text=><<TXT);
       URL: "${ \$self->req->url }"
       Mojolicious: $Mojolicious::VERSION
TXT
};

app->start;

Examples:

# http://localhost/, OK
URL: "/" Mojolicious: 2.11 

# http://localhost//, This would be a problem
URL: "" Mojolicious: 2.11 

This should also be fixed in Mojo too.

If this isn't what you're seeing then... Can you provide a test case that fails? What's the HTTP response code you receive? Are you experiencing this with GET requests..?

Thanks

sshaw commented 12 years ago

Hi, this should be fixed in this commit:

https://github.com/sshaw/Mojolicious-Plugin-DigestAuth/commit/a1deda14b2e2037c4106499f960803d1f372bb59

skaurus commented 12 years ago

Hi,

thanks for effort and sorry that we could not run further testing.

We'll test it as soon as it be available on CPAN.