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

QUERY_STRING should not contain a leading question mark (?) #229

Open
dernst opened this issue Jul 31, 2019 · 3 comments
Open

QUERY_STRING should not contain a leading question mark (?) #229

dernst opened this issue Jul 31, 2019 · 3 comments

Comments

@dernst
Copy link

dernst commented Jul 31, 2019

As per the title httpuv produces QUERY_STRING values containing the leading question mark of the form ?foo=bar where it should be foo=bar.

According to the documentation httpuv follows the Rook specification which states that "QUERY_STRING: The portion of the request URL that follows the ?, if any. [...]" [1]

Rook itself is modeled after CGI which also states that the question mark is not part of the query string and provides the following BNF syntax [2]:

   script-URI = <scheme> "://" <server-name> ":" <server-port>
                   <script-path> <extra-path> "?" <query-string>

The current behavior of httpuv is surprising and not consistent with established standards.

[1] https://github.com/jeffreyhorner/Rook
[2] https://tools.ietf.org/html/rfc3875#section-3.3

@wch
Copy link
Collaborator

wch commented Jul 31, 2019

I think you are correct that the QUERY_STRING should not contain the leading ?.

We'll have to investigate whether changing the behavior will cause problems for code that uses httpuv. I believe that shiny and plumber should be OK because they remove a leading ? only if it's present.

https://github.com/rstudio/shiny/blob/353615da897bb6015ca805ae3c830324c1dad95f/R/utils.R#L557-L558
https://github.com/trestletech/plumber/blob/b70993e8743ee5a8c279f532eb768e637ec13e8b/R/query-string.R#L17-L19

@dernst
Copy link
Author

dernst commented Aug 1, 2019

shiny/plumber seem ok to me as well. That's the R packages I found so far that do their own query string parsing.

@wch
Copy link
Collaborator

wch commented Aug 21, 2019

OK, I think we can try taking it out. We'll want to make the change after the next release of httpuv, though.

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

No branches or pull requests

2 participants