Skip to content

Conversation

@bavshin-f5
Copy link
Member

An absolute http::uri::Uri with an empty but set PathAndQuery ("") will pretend that the path is "/" for comparison, display or HTTP request construction purposes. However, a relative URI constructed from such PathAndQuery will be empty.

A directory URI without a path (i.e. "https://example.com") thus resulted in an empty path in the request line and 400 Bad Request from the server.

Fixes #97.

An absolute http::uri::Uri with an empty but set PathAndQuery ("") will
pretend that the path is "/" for comparison, display or HTTP request
construction purposes. However, a relative URI constructed from such
PathAndQuery will be empty.

A directory URI without a path (i.e. "https://example.com") thus
resulted in an empty path in the request line and 400 Bad Request from
the server.

Fixes nginx#97.
@bavshin-f5 bavshin-f5 requested a review from Copilot December 6, 2025 11:29
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where HTTP requests to directory URIs without a path (e.g., "https://example.com") resulted in 400 Bad Request errors due to an empty request path. The fix extracts and validates the path_and_query before constructing the request URI, ensuring it defaults to "/" when empty or missing.

Key changes:

  • Introduced logic to handle empty PathAndQuery by defaulting to "/"
  • Refactored URI handling to extract path_and_query earlier and validate it
  • Updated http dependency from 1.3.1 to 1.4.0

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/net/http.rs Refactored URI handling to extract and validate path_and_query before request construction, adding default "/" fallback
Cargo.toml Updated http dependency to version 1.4.0

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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 this pull request may close these issues.

unable to connect to sectigo

1 participant