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

Implement StripPrefix in wfe #1881

Merged
merged 2 commits into from
Jun 3, 2016
Merged

Implement StripPrefix in wfe #1881

merged 2 commits into from
Jun 3, 2016

Conversation

benileo
Copy link
Contributor

@benileo benileo commented Jun 3, 2016

This PR implements http.StripPrefix as a wrapper to the existing handler in wfe.go. StripPrefix is used to remove the path that it expects for each handler. Such as /acme/reg/. The remaining path is used as a slug, since multiple slugs are outside the scope of the specification.

Several tests bypassed the mux.Handle() and called the wrapped handler directly. Ex Registration. As a result of this, many tests had to be modified to no longer pass in the full path. request.URL.Path should now only ever contain the slug (if there is one).

Fixes #437

@jsha
Copy link
Contributor

jsha commented Jun 3, 2016

Excellent, thanks! Will take a deeper look in the morning PST.

@@ -852,7 +847,7 @@ func (wfe *WebFrontEndImpl) Challenge(
// Challenge URIs are of the form /acme/challenge/<auth id>/<challenge id>.
// Here we parse out the id components. TODO: Use a better tool to parse out
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove this TODO now, you've fixed it! :-)

@jsha
Copy link
Contributor

jsha commented Jun 3, 2016

LGTM modulo the one small comment there. @rolandshoemaker or @ccppuu can you do a second review?

@cpu
Copy link
Contributor

cpu commented Jun 3, 2016

LGTM ✔️

@cpu cpu added the r=ccppuu label Jun 3, 2016
@benileo
Copy link
Contributor Author

benileo commented Jun 3, 2016

Removed comment pertaining to this issue

@jsha jsha added the r=jsha label Jun 3, 2016
@jsha jsha merged commit 0f8a1a9 into letsencrypt:master Jun 3, 2016
cpu pushed a commit that referenced this pull request Nov 19, 2016
We use `http.StripPrefix` so handlers don't have to deal with stripping the boring part of URLs that they don't need (#1881). This caused either an empty string or only the ID from the path to be logged as the `endpoint` which was not useful for debugging. By doing the logging in the constructor instead we still have access to the prefix part of the path and can use it to reconstruct the full path.

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

Successfully merging this pull request may close these issues.

Encapsulate URL logic
3 participants