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

Requesting URL with char "%" in it returns HTTP Error 400. The request URL is invalid. #106

Open
ernadhodzic opened this issue Feb 24, 2023 · 4 comments

Comments

@ernadhodzic
Copy link

When URL contains character % in URL request it returns message below:

<TITLE>Bad Request</TITLE>

Bad Request - Invalid URL


HTTP Error 400. The request URL is invalid.

Is there any workaround to solve this issue ?

@jchristn
Copy link
Collaborator

I just tried this using the Test.Default project and cURL (curl http://localhost:8080/foo%bar) and could not reproduce it. Please tell me more about your environment, operating system, runtime, and whether you're trying from localhost or a remote machine.

@ernadhodzic
Copy link
Author

foo%bar indeed works. I tried now and its weird that some combinations with % works, some do not.
For example combination which does not work is: abc%1b while abc%abc can be accessed.
I think encoding also is messing with char % which as of my knowledge should not. Here is screenshot what in debugger is captured when server catches request with % in url request.
data1
As of environment, i`m using windows 10; .NET framework 4.7.2; WatsonWebserver 4.3.6.0.

@jchristn
Copy link
Collaborator

Ok, I think I see what's happening. The % is used for encoding characters into the URL, and there are only (apparently) specific valid combinations: https://developer.mozilla.org/en-US/docs/Glossary/percent-encoding and https://www.w3schools.com/tags/ref_urlencode.ASP

Are the values that fail for you outside of this supported set?

@ernadhodzic
Copy link
Author

Yes, the values which are out of this supported set are failing to find route.
Microsoft libraries which can be used for implementing restful api server are handling values which are outside of percent encoding set.

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