-
-
Notifications
You must be signed in to change notification settings - Fork 6.7k
Octets after ?
in gopher:// URL are interpreted as a query
#3369
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
Comments
And, sorry, forgot to share! ATM as a possible workaround instead of directly using |
Probably a regression since 46e1640, but not detected due lack of proper tests. Do you feel like taking on writing a fix? |
Hello Daniel,
Daniel Stenberg writes:
Probably a regression since 46e1640, but not detected due lack of proper tests.
Do you feel like taking writing up a fix?
Sure, I'm happy to try to fix that!
But, before doing that... Any idea how to best address the possible
path and query ambiguity that I've described in PS? (or, how to include
the query part but also do not omit possible trailng `?' (I think that
from lib/gopher.c, at least by using the urlpieces (data.up) we can't
distinguish that)).
Thank you!
|
If we indeed need to know if '?' was present in the URL then we need to store that information when parsing it, which isn't done now. Probably by adding a boolean to the Curl_URL struct and getting the info for it here: Lines 812 to 814 in d8607da
Possibly a smoother approach is that we work around it and avoid extending that struct, so that if the URL is a gopher one, we store a zero length query. |
Surely URLs with no query and with an empty query are semantically different? If so, then it may be as simple as changing if(query && query[0]) {
u->query = strdup(query); to if(query) {
u->query = strdup(query); Similarly for fragment. |
The Infinnovation team writes:
Surely URLs with no query and with an empty query are semantically different? If so, then it may be as simple as changing
```c
if(query && query[0]) {
u->query = strdup(query);
```
to
```c
if(query) {
u->query = strdup(query);
```
Similarly for fragment.
Mostly yes (needs also another tiny further change), I will
hopefully share patches that does something like that in the next
minutes! (time to cleanly rebuild and rerun all the tests!)
Thanks!
|
Please note that I have not adjusted fragments handling similarly. In my experience it is less common (and probably pretty rare!) to
IIUC the fragment part - unlike the query - should be not sent to |
According RFC 4266 a
gopher://
URL is:However, everything after a `?' is ignored.
I did this
I will denote with a
S>
the server, andC>
the client:I expected the following
No
?
and (if any) no octets after the?
should be omitted.curl/libcurl version
operating system
NetBSD
PS: Please note that AFAICS we have no way to distunguish between a:
gopher://host:port/path
andgopher://host:port/path?
and so I thinkthat
gopher_do()
inlib/gopher.c
could not be adjusted to just takethe concatenation of
data->state.up.path
anddata->state.up.query
(in both cases
data->state.up.query
seems NULL).Of course, if you have any idea how to better implement that,
feel free to share it and I'll try to write a possible patch!
Thank you very much!
The text was updated successfully, but these errors were encountered: