-
Notifications
You must be signed in to change notification settings - Fork 64
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
Listener does not handle double slashes in the URL #3543
Listener does not handle double slashes in the URL #3543
Comments
Tested the behavior with the following service : import ballerina/http;
service on new http:Listener(9090) {
resource function get foo() returns http:Ok {
return {body: "Greetings!"};
}
}
The above behavior is observed due to the parsing done by the // [//authority]<path>[?<query>]
//
// DEVIATION from RFC2396: We allow an empty authority component as
// long as it's followed by a non-empty path, query component, or
// fragment component. This is so that URIs such as "file:///foo/bar"
// will parse. This seems to be the intent of RFC2396, though the
// grammar does not permit it. If the authority is empty then the
// userInfo, host, and port components are undefined.
//
// DEVIATION from RFC2396: We allow empty relative paths. This seems
// to be the intent of RFC2396, but the grammar does not permit it.
// The primary consequence of this deviation is that "#f" parses as a
// relative URI with an empty path. |
Since the path component being passed( |
This issue is NOT closed with a proper Reason/ label. Make sure to add proper reason label before closing. Please add or leave a comment with the proper reason label now. |
Description:
URL contains double slashes
The tracelog shows double slashes as expected. Check the serviceUrl trailing slash and the resourcePath leading slash
This leads to the String index out of range: -1.
Earlier HTTP client had this sanitization where we replaced mulitple slashes in to a single one and sent out the request. But later on it was removed it as it's kinda of modification done internally to the user input.
However the response should be 404, not 500 from the backend.
Steps to reproduce:
Client.bal
Main.bal
Backend.bal
Client output
The text was updated successfully, but these errors were encountered: