Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upUpdate basic auth cache to key off of origin instead of url #13281
Conversation
highfive
commented
Sep 15, 2016
|
Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @Ms2ger (or someone else) soon. |
highfive
commented
Sep 15, 2016
|
Heads up! This PR modifies the following files:
|
|
This looks really great! There's only one change we can make to ensure that the new test is robust against timing changes. |
| <script type="text/javascript"> | ||
| var authImg = '<img src="http://testuser:testpass@' + window.location.host + '/http/resources/securedimage.py">'; | ||
| document.getElementById('auth').innerHTML = authImg; | ||
| setTimeout(function() { |
This comment has been minimized.
This comment has been minimized.
jdm
Sep 15, 2016
Member
Rather than a timeout (which could cause intermittent failures if the first image finishes loading before the timeout fires), we should:
- add
class="reftest-wait"to the<html>element - add an onload handler to the first image, which starts the second image load
- add an onload handler to the second load which removes the reftest-wait class
This comment has been minimized.
This comment has been minimized.
gilbertw1
Sep 15, 2016
Author
Contributor
Thanks for the feedback! I've just incorporated the test changes in a new commit.
|
|
09ab326
to
54c7c33
|
@jdm: Could you please advise on the MANIFEST.json file? Are the test entries in the correct location, should I update it in some way so that the CI build will pass? Thanks! |
|
If you run |
54c7c33
to
43dae3d
|
Thanks! Problem fixed. |
| @@ -1,15 +1,26 @@ | |||
| <!doctype html> | |||
| <meta charset="utf-8"> | |||
| <link rel="match" href="basic-auth-cache-test-ref.html"> | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
…st errors
43dae3d
to
715682c
|
@bors-servo: r+ |
|
|
Update basic auth cache to key off of origin instead of url This pull request's primary purpose is to store basic auth credentials based on the url origin instead of the entire url. This fixes an issue where servo continuously prompts the user for credentials any time a basic auth secured resource is requested even though the user has already entered auth credentials for a different resource from the same origin. The test associated with this PR hides image redirects behind a python handler that requires basic authentication. The reference page loads two images by directly specifying the image to load, while the test page loads the two images using the basic auth redirect handler with only the first image tag providing auth credentials. I'd like to point a few specific items for review: * url::Origin does not derive ```Hash```, so I am using ```ascii_serialization``` as the cache key. This seems like a stable enough representation. * I've updated the http loader to store credentials not only on Success responses, but Redirect responses as well. I stumbled on this because nginx was redirecting 'test' -> 'test/' in my testing, and other browsers were storing the credentials on the redirect response vs. prompting for credentials a second time. * In the test I'm using a timeout to load the second image (without authentication), otherwise the order that the images were loaded was unpredictable. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [x] `./mach build -d` does not report any errors - [x] `./mach test-tidy` does not report any errors related to these changes - [x] These changes fix #12095 (github issue number if applicable). <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13281) <!-- Reviewable:end -->
|
|
|
No problem, I plan to continue contributing in the future! |
gilbertw1 commentedSep 15, 2016
•
edited by larsbergstrom
This pull request's primary purpose is to store basic auth credentials based on the url origin instead of the entire url. This fixes an issue where servo continuously prompts the user for credentials any time a basic auth secured resource is requested even though the user has already entered auth credentials for a different resource from the same origin.
The test associated with this PR hides image redirects behind a python handler that requires basic authentication. The reference page loads two images by directly specifying the image to load, while the test page loads the two images using the basic auth redirect handler with only the first image tag providing auth credentials.
I'd like to point a few specific items for review:
Hash, so I am usingascii_serializationas the cache key. This seems like a stable enough representation../mach build -ddoes not report any errors./mach test-tidydoes not report any errors related to these changesThis change is