On Jan 26, 8:45 am, Alvaro Lopez Ortega <[email protected]> wrote:
> On 26/01/2011, at 14:15, Lee Connell wrote:
>
>
>
>
>
>
>
>
>
> > On Wed, Jan 26, 2011 at 4:24 AM, Alvaro Lopez Ortega <[email protected]> 
> > wrote:
> > On 25/01/2011, at 20:44, Lee Connell wrote:
>
> >> This is the URL I generated and sent back to the client:
> >>http://www.example.com:81/secure_files/457c02a1ad1d92c5be833e163b3cf8...
>
> >> I get a 403 Forbidden, you have no access to the requested URL.
>
> >> If I wait the default 60 seconds i get:
> >> 410 Gone, The requested URL 
> >> /secure_files/457c02a1ad1d92c5be833e163b3cf87b/4d3f25ac/pass.txt is no 
> >> longer available on this server and there is no forwarding address
>
> >> How come I am being denied initially?
>
> > The MD5 was incorrect, most likely because of how you built the raw string 
> > from your script.
>
> > This is what I used to generate the url, same as what is available in the 
> > docs.
>
> > def generate_download(filename):
> >     secret = 'mysecret'
> >     prefix = '/secure_files'
> >     t = '%08x' % (time.time())
> >     return prefix + "/%s/%s/%s" % (hashlib.md5(secret + filename + 
> > t).hexdigest(), t, filename)
>
> Usually the problem is related to duplicated or missing slash characters in 
> the intermediate strings. I'd personally start by checking the value of the 
> following strings:
>
>   - secret + filename + t
>   - prefix + "/%s/%s/%s" % (hashlib.md5(secret + filename + t).hexdigest(), 
> t, filename)
>
> --
> Octalityhttp://www.octality.com/
>
> _______________________________________________
> Cherokee mailing list
> [email protected]http://lists.octality.com/listinfo/cherokee

I don't see what is going wrong here, no slashes are missing or
duplicated.

here are the values individually and as a whole:

time: 4d41c2ba
md5: 679f15c6f3c8d3644d5298832f2b7d49
file: pass.txt
final value: /secure_files/679f15c6f3c8d3644d5298832f2b7d49/4d41c2ba/
pass.txt

def generate_download(file):
    secret = "secret"
    prefix = "/secure_files"
    t = '%08x' % (time.time())
    m = hashlib.md5(secret + file + t).hexdigest()
    print t
    print m
    print file
    return prefix + "/%s/%s/%s" % (m, t, file)
_______________________________________________
Cherokee mailing list
[email protected]
http://lists.octality.com/listinfo/cherokee

Reply via email to