Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP Digest intermittent log-in pop-up #16

Closed
mogsie opened this issue Apr 26, 2012 · 5 comments
Closed

HTTP Digest intermittent log-in pop-up #16

mogsie opened this issue Apr 26, 2012 · 5 comments

Comments

@mogsie
Copy link
Contributor

mogsie commented Apr 26, 2012

I'm not 100% sure but sometimes, with server and client on the same machine, I get log-in dialog boxes. I traced the problem (possibly) to out-of-order nonces when requests were fired by the browser in quick succession (simply an HTML page with elements).

I can trigger the problem by having a web page and associated images (3 images is enough to trigger it) that are digest protected, and using a browser to access the web page.

If I add latency of 100ms or so between the new requests (using javascript), then all requests work fine.

I'm not sure if this is really the case (out-of-order nonces) since I've seen seeminlgy in-order nonces (from the browser's point of view) fail. When I add a console.log of req.header.authorization, I see that when the nc are in-order, everything is good, and that when the nc are out-of-order, I get the 401 login prompt.

@mogsie
Copy link
Contributor Author

mogsie commented Apr 26, 2012

It seems I can fix it by keeping a cache of all used nonces, but that seems like an enormous memory leak to me.

If I change e.g. the elements of the this.nonces[] array to be "arrays of co.nc" instead of just the "last" nonce count then I don't get the problem even when the browser passes out-of-order nonces.

@gevorg
Copy link
Owner

gevorg commented Apr 28, 2012

Thanks for reporting I will reproduce issue and let you know.

Gevorg.

gevorg added a commit that referenced this issue Apr 28, 2012
@gevorg
Copy link
Owner

gevorg commented Apr 28, 2012

I have fixed the issue, by adding STALE option. Fix is committed to git and published to npm with 1.2.2 version.

Gevorg.

@gevorg gevorg closed this as completed Apr 28, 2012
@mogsie
Copy link
Contributor Author

mogsie commented Apr 28, 2012

Thanks. Will test it immediately!

mogsie added a commit to mogsie/http-auth that referenced this issue Apr 28, 2012
…s). They do expire after a while, but the overhead might be problematic if you have too many requests."

This reverts commit f2c1aa7.

Issue gevorg#16 solved in a much more elegant way
@mogsie
Copy link
Contributor Author

mogsie commented Apr 28, 2012

It works perfectly :-) The occasional 401 I now see doesn't cause browsers to pop up a dialog box. Sweet!

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

Successfully merging a pull request may close this issue.

2 participants