Skip to content

Fix/epoll iocp headers - #510

Merged
regyssilveira merged 4 commits into
HashLoad:masterfrom
regyssilveira:fix/epoll-iocp-headers
Jul 9, 2026
Merged

Fix/epoll iocp headers#510
regyssilveira merged 4 commits into
HashLoad:masterfrom
regyssilveira:fix/epoll-iocp-headers

Conversation

@regyssilveira

Copy link
Copy Markdown
Contributor

PR: Fix HTTP headers and response body mapping on async/high-performance providers

Description

This PR resolves the issue where custom/standard HTTP headers and response contents (such as JSON generated by middlewares) were not correctly delivered or sent when using asynchronous and high-performance providers (epoll, IOCP, and HttpSys).

Key Fixes:

  1. HTTP Headers Mapping:

    • Added PopulateHeaders method to the IHorseRawRequest interface.
    • Implemented PopulateHeaders in TEpollRawRequest, TIocpRawRequest, and THttpSysRawRequest (extracting headers dynamically according to the requested NameValueSeparator).
    • Integrated THorseCoreParamHeader.GetHeadersList to delegate to PopulateHeaders if the web request is a TInterfacedWebRequest.
  2. Response Content Delivery:

    • Implemented Content and ContentStream properties on the Delphi TInterfacedWebResponse adapter class.
    • Updated the SendResponse routine in both epoll and IOCP providers to extract and output data from the adapter's Content/ContentStream properties when populated.
  3. Compiler and Version Compatibility:

    • Fixed compilation on older versions of Delphi (e.g. Delphi 10 Seattle) by shielding GetRawContent inside appropriate version conditionals (CompilerVersion >= 32.0).
    • Replaced TEncoding.UTF8.GetString with standard SetString (zero-allocation and cross-compiler compatible) in the FPC/epoll provider code.
  4. Integration Testing:

    • Added unit test cases for custom HTTP headers on Windows (Tests.Api.Console.pas).
    • Enabled -dHORSE_PROVIDER_EPOLL on Lazarus integration tests within the Docker container.

Validation and Tests

  • Delphi/Windows: Verified with all Delphi versions (10 Seattle up to 13 Florence) under both IOCP and HttpSys providers. All tests passed.
  • FPC/Linux: Verified with the epoll loop inside the Lazarus docker container. All integration tests succeeded.

@regyssilveira
regyssilveira merged commit 9b1c1c3 into HashLoad:master Jul 9, 2026
@regyssilveira
regyssilveira deleted the fix/epoll-iocp-headers branch July 9, 2026 22:12
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.

1 participant