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

Fix URL parsing w/ trailing slash & querystring #1539

Merged
merged 3 commits into from
Dec 6, 2019

Conversation

scottinet
Copy link
Contributor

@scottinet scottinet commented Dec 2, 2019

Description

Fix a bug where an URL containing both a trailing slash and a querystring would be incorrectly parsed.

How to reproduce

The following HTTP GET request works fine:

http://localhost:7512/_now?pretty

But not this one without this PR:

http://localhost:7512/_now/?pretty

Both requests are equivalent and should be regarded as identical.

Other changes

Use the WHATWG URL parsing API instead of the legacy (and deprecated) Node.js URL parser.
Unfortunately, the latter was much more adapted to URL parsing server-side than the former. 😑

Reverted to the legacy URL API because of:

@codecov
Copy link

codecov bot commented Dec 3, 2019

Codecov Report

Merging #1539 into 2-dev will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@           Coverage Diff           @@
##            2-dev    #1539   +/-   ##
=======================================
  Coverage   93.52%   93.52%           
=======================================
  Files          98       98           
  Lines        6749     6749           
=======================================
  Hits         6312     6312           
  Misses        437      437
Impacted Files Coverage Δ
lib/core/httpRouter/routePart.js 100% <100%> (ø) ⬆️
lib/core/httpRouter/index.js 98.64% <100%> (-0.04%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b6443aa...c4af16a. Read the comment docs.

@scottinet scottinet merged commit 6e88784 into 2-dev Dec 6, 2019
@scottinet scottinet deleted the 2/fix-trailing-slash-in-url branch December 6, 2019 10:45
@scottinet scottinet mentioned this pull request Dec 6, 2019
scottinet added a commit that referenced this pull request Dec 6, 2019
# [2.0.1](https://github.com/kuzzleio/kuzzle/releases/tag/2.0.1) (2019-12-06)


#### Bug fixes

- [ [#1534](#1534) ] Configured server limit were not applied to some m* and deleteByQuery routes   ([scottinet](https://github.com/scottinet))
- [ [#1539](#1539) ] Fix URL parsing w/ trailing slash & querystring   ([scottinet](https://github.com/scottinet))
- [ [#1531](#1531) ] Enforce naming rules on indexes and collections   ([scottinet](https://github.com/scottinet))
- [ [#1530](#1530) ] Rejects new API requests during a shutdown sequence   ([scottinet](https://github.com/scottinet))
- [ [#1504](#1504) ] Do not delete a profile still assigned to users   ([Yoann-Abbes](https://github.com/Yoann-Abbes))

#### Enhancements

- [ [#1533](#1533) ] Add plugin version to server info   ([Aschen](https://github.com/Aschen))
- [ [#1536](#1536) ] Prevent overloads caused by pre-funnel pipes   ([scottinet](https://github.com/scottinet))
- [ [#1543](#1543) ] Use [email protected]   ([scottinet](https://github.com/scottinet))
---
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.

3 participants