From 3be4e0980075de10a4bc8dee07491d49175cfd7a Mon Sep 17 00:00:00 2001 From: Cory Benfield Date: Tue, 9 Mar 2021 12:18:33 +0000 Subject: [PATCH] Make HTTP Parser import implementationOnly (#1776) Motivation: Non-implementation-only imports in Swift have an annoying tendency to put C header files into all downstream build paths. The result is that leaf packages that include any C header files run a very high risk of colliding with declarations in the inner header files. In this case, we've had users bump into issues with the HTTP_STATUS_* enum cases already. Modifications: - Make CNIOHTTPParser import implementationOnly where possible. Result: Fewer risks of colliding symbols. --- Sources/NIOHTTP1/HTTPDecoder.swift | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Sources/NIOHTTP1/HTTPDecoder.swift b/Sources/NIOHTTP1/HTTPDecoder.swift index 73ac7ccab..4e5e2ab6f 100644 --- a/Sources/NIOHTTP1/HTTPDecoder.swift +++ b/Sources/NIOHTTP1/HTTPDecoder.swift @@ -13,7 +13,11 @@ //===----------------------------------------------------------------------===// import NIO +#if compiler(>=5.1) +@_implementationOnly import CNIOHTTPParser +#else import CNIOHTTPParser +#endif private extension UnsafeMutablePointer where Pointee == http_parser { /// Returns the `KeepAliveState` for the current message that is parsed.