Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Problem with long auth credentials #1

Open
vortura opened this issue Jan 3, 2014 · 0 comments
Open

Problem with long auth credentials #1

vortura opened this issue Jan 3, 2014 · 0 comments

Comments

@vortura
Copy link

vortura commented Jan 3, 2014

Hi Mike,

I've found a small problem with your module when the base64 PointHQ auth credentials are longer than 76 characters. The encoded output wraps at this point, which causes the request header to be invalid. You end up with something like this:

GET /zones HTTP/1.1
Host: pointhq.com
accept-encoding: gzip, deflate
content-type: application/json
accept: application/json
authorization: Basic dXNlcm5hbWVAZXhhbXBsZWRvbWFpbi5jb206YWhma2poYXNsa2Rmamhsa2oyMzRpeW9paGZzbGtk
amhma2xzc2pkaGY=
user-agent: Python-httplib2/0.8 (gzip)

Note that the authorization header is wrapped over two lines. The second line is invalid HTTP, and you get a 500 back from the Point API. I've fixed the problem in my own code by stripping newlines from the encoded output so the authorization header uses a single line. This appears to be the approach taken by the Python requests library, and by curl.

I will send a pull request referencing this issue that includes my fix.

Thanks for the great module,
Richard

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

No branches or pull requests

1 participant