Skip to content

Conversation

@erikdubbelboer
Copy link
Collaborator

Keep our server behaviour the same as net/http.

Keep our server behaviour the same as net/http.
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 ensures the server rejects HTTP requests with backslash absolute URIs to maintain compatibility with net/http behavior, while also adding error caching to improve performance and prevent duplicate parsing attempts.

  • Adds URI parsing validation in the server connection handler to reject malformed absolute URIs
  • Caches URI parse errors in the Request struct to avoid redundant parsing
  • Updates test comparison method to use string representation instead of deep equality

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
server.go Adds URI parsing validation in serveConn to reject invalid requests early
http.go Implements error caching mechanism for URI parsing with proper state management
server_test.go Adds test case to verify backslash absolute URI rejection behavior
http_test.go Updates request comparison logic to use string serialization instead of reflection

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@erikdubbelboer erikdubbelboer merged commit f18eb9e into master Oct 5, 2025
7 checks passed
@erikdubbelboer erikdubbelboer deleted the fix-bad-request-uri branch October 9, 2025 04:16
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.

2 participants