Feature/httpsys provider - #472
Merged
viniciussanchez merged 5 commits intoJun 24, 2026
Merged
Conversation
…lidade com HTTP.sys
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements the native Windows HTTP.sys transport provider (
Winapi.HttpApi) for the Horse framework, enabled via the compile-time conditional defineHORSE_PROVIDER_HTTPSYS.This provider runs HTTP parsing, connection pool management, and routing directly inside the Windows kernel-mode driver, providing superior performance, lower resource consumption (CPU/RAM), and native features such as port sharing and SSL/TLS management (via Schannel) with zero DLL dependencies.
Key Changes & Design Decisions
Winapi.HttpApi.pasnativelly supported on Delphi. No external DLLs (like OpenSSL) or libraries required.Horse.Provider.RawAdapters.pas(which contains empty write stubs forTInterfacedWebResponse), we inherited it locally asTHttpSysWebResponseinsideHorse.Provider.HttpSys.pas, implementing write properties (StatusCode,Content,ContentType) in isolation.IHorseRawRequest/IHorseRawResponse) to allow Delphi's Reference Counting to safely clean up memory and buffers, preventing double-free AVs and race conditions on multi-threaded environments.{$MINENUMSIZE 4}) for correct compatibility withhttpapi.dllstructures on x86/x64 platforms.localhostand127.0.0.1binds directly, which bypasses the Windows requirement for Administrator privileges during development.tests/: Added a commented{.$DEFINE HORSE_PROVIDER_HTTPSYS}on API tests (Tests.Api.Console.pasandTests.Api.Vcl.pas) so developers can easily toggle the test suite locally to run under HTTP.sys.samples/: Added a fully working console application sample undersamples/delphi/httpsys/showcasing path parameters, query parameters, and native JSON response.