Skip to content

fix: rename vendored HTTPParserC enums to avoid macOS http.h conflicts#3073

Open
brucearctor wants to merge 2 commits into
leancodepl:masterfrom
brucearctor:fix/macos-http-parser-enum-conflict
Open

fix: rename vendored HTTPParserC enums to avoid macOS http.h conflicts#3073
brucearctor wants to merge 2 commits into
leancodepl:masterfrom
brucearctor:fix/macos-http-parser-enum-conflict

Conversation

@brucearctor

Copy link
Copy Markdown

Problem

The vendored http_parser.h (inside darwin/Classes/Telegraph/HTTPParserC/) defines enum types (http_method, http_status, http_errno) that conflict with macOS system header <http.h>, causing compilation failures on macOS targets.

A previous fix already prefixed the enum values (HTTP_GETPARSER_HTTP_GET), but the enum type names and function signatures were not updated.

Solution

Rename the enum types to avoid namespace collisions:

  • enum http_methodenum http_parser_method
  • enum http_statusenum http_parser_status
  • enum http_errnoenum http_parser_errno

Also updates the Swift typealias and usage in HTTPParser+Raw.swift to reference the renamed types.

This matches the approach from the now-closed HTTPParserC PR #4 (upstream has since moved to llhttp).

Files Changed (3 files, 15 line swaps)

  • http_parser.h — renamed enum type declarations and function signatures
  • http_parser.c — renamed enum type references in function implementations
  • HTTPParser+Raw.swift — updated typealias and constructor call

Fixes #1976

The vendored http_parser.h defines enum types (http_method, http_status,
http_errno) that conflict with macOS system header <http.h>, causing
compilation failures on macOS targets.

This renames the enum types to http_parser_method, http_parser_status,
and http_parser_errno to avoid namespace collisions. The enum values
were already prefixed with PARSER_HTTP_* in a previous fix, but the
type names themselves were not.

Also updates the Swift typealias and usages in HTTPParser+Raw.swift to
reference the renamed types.

Fixes leancodepl#1976
@github-actions github-actions Bot added the package: patrol Related to the patrol package (native automation, test bundling) label May 17, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request renames the http_method, http_status, and http_errno enums to http_parser_method, http_parser_status, and http_parser_errno respectively across the C and Swift source files to improve naming consistency. A review comment identifies a remaining reference to the old enum name in a code comment within http_parser.h that should be updated for consistency.

Comment thread packages/patrol/darwin/Classes/Telegraph/HTTPParserC/http_parser.h
@brucearctor

Copy link
Copy Markdown
Author

looks like failures are due to permissions?

Address Gemini code review feedback — the comment on line 274 still
referenced the old 'http_errno' enum name.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: patrol Related to the patrol package (native automation, test bundling)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Telegraph is not working with macOS

1 participant