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

Issue: Default Path Not Set in FastHTTP Client for URIs with Only Query Parameters #1659

Open
skidder opened this issue Nov 14, 2023 · 1 comment

Comments

@skidder
Copy link
Contributor

skidder commented Nov 14, 2023

Problem Description

The FastHTTP client fails to set a default path (/) for request URIs that include only query parameters but no path. This behavior diverges from common web clients (like cURL, Chrome, Firefox) and does not align with the HTTP 1.1 specification.

Expected Behavior

An HTTP GET request for a URI like https://example.com?foo=bar should generate a request header in the format:

GET /?foo=bar

This follows the standard outlined in the HTTP 1.1 spec, section 5.3.1, which states that clients must treat an empty path as /.

Actual Behavior

Currently, FastHTTP generates a header like:

GET ?foo=bar

This can lead to failures with servers that do not default to a path of / when one is not specified.

Suggested Fix

Modify FastHTTP's RequestURI function in http.go to check for an empty path and set it to / if necessary. This ensures compatibility with a wider range of HTTP servers and adherence to the HTTP 1.1 specification.

@erikdubbelboer
Copy link
Collaborator

A pull request would be welcome! Or some code to reproduce this so we can easily write a test and fix that.

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

Successfully merging a pull request may close this issue.

2 participants