kumar303 / mohawk

Python library for Hawk HTTP authorization
BSD 3-Clause "New" or "Revised" License
47 stars 20 forks source link

Update util.py #27

Closed dav92lee closed 8 years ago

dav92lee commented 8 years ago

This pull requests solves the error of when one of the fields in auth header has more than one equal sign.

The absence of this feature was problematic for me when i wanted a dictionary stored in the ext field:

ext="key1=value1;key2=value2"
kumar303 commented 8 years ago

Oh yeah, that code is a little hairy. Thanks for digging into this.

Your patch would need some tests to make sure it doesn't break again. Here is one you can copy/modify https://github.com/kumar303/mohawk/blob/master/mohawk/tests.py#L322

Rather than counting equal signs it's probably safer to use a regex like the Hawk library: https://github.com/hueniverse/hawk/blob/master/lib/utils.js#L147 If that gets too hairy then at least adding your fix (with some tests) would be a great start.

dav92lee commented 8 years ago

I'm new to this github stuff, so I hope I did it correctly. I think i modified one of the tests and committed it with this pull request.

kumar303 commented 8 years ago

Thanks. This code should probably get rewritten soon :) but your fix looks like it will work.

dav92lee commented 8 years ago

Awesome! Was also wondering when you are planning your next release