Skip to content

Conversation

@karlseguin
Copy link
Collaborator

The HTTP response values are mutable, but because we're using std.http.Header the type is a []const u8. This introduce a custom Header type where the value is []u8.

The goal is largely to allow more efficient value-comparison, by allowing calling code to lower-case in-place. I specifically have the Mime parser in mind:

4 => if (isCaseEqual("text", main_type)) {

The HTTP response values _are_ mutable, but because we're using std.http.Header
the type is a `[]const u8`. This introduce a custom `Header` type where the
value is `[]u8`.

The goal is largely to allow more efficient value-comparison, by allowing
calling code to lower-case in-place. I specifically have the Mime parser in
mind:

https://github.com/lightpanda-io/browser/blob/25dcae76487ab2aaa8ac8b468f465e55007a76ee/src/browser/mime.zig#L134
@krichprollsch krichprollsch merged commit 1c08b3e into main Apr 17, 2025
12 checks passed
@krichprollsch krichprollsch deleted the mutable_response_header_value branch April 17, 2025 11:10
@github-actions github-actions bot locked and limited conversation to collaborators Apr 17, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants