-
Notifications
You must be signed in to change notification settings - Fork 18
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
Bad request when you don't put a slash at the end of the URL #29
Comments
What's the expected behavior? Should we raise a specific exception due to invalid URL? |
Something like this would probably solve the issue. diff --git a/lib/ftw/request.rb b/lib/ftw/request.rb
index be75334..14323a5 100644
--- a/lib/ftw/request.rb
+++ b/lib/ftw/request.rb
@@ -111,7 +111,11 @@ class FTW::Request
end
# uri.password
# uri.user
- @request_uri = uri.path
+ if !uri.path.empty?
+ @request_uri = uri.path
+ else
+ @request_uri = "/"
+ end
# Include the query string, too.
@request_uri += "?#{uri.query}" if !uri.query.nil? Or if you consider the URL as an invalid one, throwing an exception with a proper message when the The thing is that if I do |
Path-less URLs aren't invalid (see §3 of RFC 3986) so this library should happily accept them and refrain from making malformed HTTP requests like There's at least one issue reported in https://github.com/logstash-plugins/logstash-input-websocket that stems from this bug. |
Hello,
the library fails when you don't specify a path. For example this ruby code works:
Output:
Without the
/
at the end of the URL:Output:
I am trying with a new httpd installation, in case you want to reproduce the same error. What I get in the access logs is the following.
This was resulting in this error in logstash, when I was trying to use a Flume source to get messages.
The text was updated successfully, but these errors were encountered: