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

failed to parse URL https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen #17

Open
FraMecca opened this issue May 18, 2019 · 2 comments

Comments

@FraMecca
Copy link

The url in question is:
https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen"

import url;

void main()
{
    auto url = "https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen"
            .parseURL;
}
(2) user (7) /t/ur> dub
Performing "debug" build using /usr/bin/dmd for x86_64.
urld 2.1.1: target for configuration "library" is up to date.
ur ~master: building configuration "application"...
Linking...
To force a rebuild of up-to-date targets, run again with --force.
Running ./ur 
url.URLException@/home/user/.dub/packages/urld-2.1.1/urld/source/url.d(31): failed to parse URL https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen
----------------
/home/user/.dub/packages/urld-2.1.1/urld/source/url.d:1146 pure @safe url.URL url.parseURL(immutable(char)[]) [0xd4f267d0]
/tmp/ur/source/app.d:7 _Dmain [0xd4f26517]
Program exited with code 1
@FraMecca FraMecca changed the title url.URLException@/home/user/.dub/packages/urld-2.1.1/urld/source/url.d(31): failed to parse URL https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen failed to parse URL https://www.blogfree.net/?l=4&wiki=Allgemeine_Gesch%E4ftsbedingungen May 18, 2019
@dhasenan
Copy link
Owner

Thanks for the report! This is a somewhat awkward problem to work around.

%E4f is not a valid UTF-8 sequence, so percent-decoding it would result in an invalid string that would blow up later.

Right now, urld auto-encodes query parameters, so not decoding that sequence would fail to round-trip correctly — it would turn into '%25E4'.

What urld needs to do is keep around both the encoded and unencoded version of each string.

@FraMecca
Copy link
Author

Why do you need to store query parameters as encoded sequence?

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