Update KibanaRequest to use the new WHATWG URL API#80713
Merged
watson merged 6 commits intoelastic:masterfrom Oct 29, 2020
Merged
Update KibanaRequest to use the new WHATWG URL API#80713watson merged 6 commits intoelastic:masterfrom
watson merged 6 commits intoelastic:masterfrom
Conversation
3f0085c to
6aa7526
Compare
cee-chen
approved these changes
Oct 26, 2020
x-pack/plugins/enterprise_search/server/lib/enterprise_search_config_api.test.ts
Outdated
Show resolved
Hide resolved
Contributor
|
Pinging @elastic/ingest-management (Team:Ingest Management) |
Co-authored-by: Constance <constancecchen@users.noreply.github.com>
mshustov
approved these changes
Oct 27, 2020
mshustov
reviewed
Oct 27, 2020
| // | ||
| // The details can be seen in this discussion on Twitter: | ||
| // https://twitter.com/wa7son/status/1319992632366518277 | ||
| let urlCopy = ''; |
Contributor
There was a problem hiding this comment.
I'm glad I didn't have to debug this 😄
gmmorris
approved these changes
Oct 28, 2020
Contributor
gmmorris
left a comment
There was a problem hiding this comment.
LGTM for Alerts, TaskManager & EventLog 👍
Contributor
|
ACK: will review the security team related changes today or tomorrow morning at the latest. |
thomheymann
approved these changes
Oct 28, 2020
Contributor
thomheymann
left a comment
There was a problem hiding this comment.
Awesome, looks good!
Contributor
💚 Build SucceededMetrics [docs]
History
To update your PR or re-run it, just comment with: |
azasypkin
approved these changes
Oct 29, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is a prerequisite for upgrading to hapi v18.
The reason for this is that the new version of hapi uses the WHATWG URL format for its
request.urlproperty instead of the legacy url format.Note to reviewers
The hack of using
request._core.info.urito build the new URL object, isn't needed once we upgrade to hapi v18, as this version of hapi already uses the WHATWG URL API. So instead of constructing the URL object once theKibanaRequestis instantiated, we simply copy it from the hapi request object.Note to future self
If you remove the
urlCopyhack insrc/core/server/http/lifecycle/on_pre_routing.ts, you can reproduce the problem it's trying to fix by first performing the following cURL request:This will prime the process and put it in a state where the error will occur in the next request, which you perform with the following cURL request:
The first cURL request will trigger the
request.setUrlline insrc/core/server/http/lifecycle/on_pre_routing.ts, which will screw up the internal object holding the routing table in such a way that thecallrouter used byhapican't find thesaved_objectssegment underapiand will make the request fall through to the catch-all route.The only thing needed from this PR to trigger the bug, is the following in
src/core/server/http/router/request.ts: