Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: bdef87bb7be060c1c1f289a160a765b58d767aaf
      
https://github.com/WebKit/WebKit/commit/bdef87bb7be060c1c1f289a160a765b58d767aaf
  Author: Richard Robinson <[email protected]>
  Date:   2026-09-12 (Sat, 12 Sep 2026)

  Changed paths:
    M Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.h
    M Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.mm
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerBridging.h
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerBridging.swift
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerConnection.swift
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerCore.swift
    A Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerRouting.swift
    M Tools/TestWebKitAPI/PlatformCocoa.cmake
    M Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
    M Tools/TestWebKitAPI/TestWebKitAPILibrary/module.modulemap

  Log Message:
  -----------
  [Swift Testing] Replace the core implementation of HTTPServer with Swift 
(part 1)
https://bugs.webkit.org/show_bug.cgi?id=323963
rdar://187198291

Reviewed by Abrar Rahman Protyasha and Alex Christensen.

This is the start of replacing the implementation of HTTPServer to be in Swift.
With this change, HTTPServer clients now use a Swift implementation for the 
HTTP protocol.

Currently, the HTTPServer type is a C++ interface with an Objective-C++ 
implementation.
For Swift, there also exists an HTTPServer Swift type which is a facade over 
the C++ interface.

With this change, there is a new HTTPServerCore Swift type which will work to 
eventually
replace all the logic inside the HTTPServer Objective-C++ implementation. There 
is also a new
HTTPServerBridge type with an Objective-C interface and a Swift implementation. 
The Swift
implementation simply forwards to HTTPServerCore, and the interface is consumed 
by the
HTTPServer Objective-C++ implementation.

In subsequent parts, this architecture will be updated such that the Swift 
HTTPServer type
will depend on HTTPServerCore instead of the C++ HTTPServer interface, and all 
protocols will
be implemented in HTTPServerCore.

Eventually, if there comes a time when there's no C++ clients of HTTPServer, 
then the entirety
of HTTPServer.h, HTTPServer.mm, HTTPServerBridge.h, and HTTPServerBridge.swift 
can be removed.

* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.h:
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServer.mm:
(TestWebKitAPI::toNSDictionary):
(TestWebKitAPI::toHTTPResponseDataBridge):
(TestWebKitAPI::useSwiftImplementation):
(TestWebKitAPI::HTTPServer::startListening):
(TestWebKitAPI::HTTPServer::cancel):
(TestWebKitAPI::HTTPServer::terminateAllConnections):
(TestWebKitAPI::HTTPServer::HTTPServer):
(TestWebKitAPI::HTTPServer::addResponse):
(TestWebKitAPI::HTTPServer::setResponse):
(TestWebKitAPI::HTTPServer::totalConnections const):
(TestWebKitAPI::HTTPServer::totalRequests const):
(TestWebKitAPI::HTTPServer::lastRequestCookies const):
(TestWebKitAPI::HTTPServer::sawAuthorizationHeader const):
(TestWebKitAPI::HTTPServer::port const):
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerBridging.h: Added.
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerBridging.swift: Added.
(HTTPServerBridge.port):
(HTTPServerBridge.totalRequests):
(HTTPServerBridge.totalConnections):
(HTTPServerBridge.lastRequestCookies):
(HTTPServerBridge.sawAuthorizationHeader):
(HTTPServerBridge.startListening):
(HTTPServerBridge.cancel):
(HTTPServerBridge.terminateAllConnections):
(HTTPServerBridge.addResponse(_:forPath:)):
(HTTPServerBridge.setResponse(_:forPath:)):
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerConnection.swift: Added.
(NWConnection.receiveBytes(_:)):
(NWConnection.receiveHTTPRequest):
(NWConnection.send(_:)):
(NWConnection.terminate):
(contentLength(in:)):
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerCore.swift: Added.
(HTTPServerCore.connections):
(HTTPServerCore.responses):
(HTTPServerCore.port):
(HTTPServerCore.totalConnections):
(HTTPServerCore.totalRequests):
(HTTPServerCore.startListening):
(HTTPServerCore.cancel):
(HTTPServerCore.terminateAllConnections):
(HTTPServerCore.addResponse(_:for:)):
(HTTPServerCore.setResponse(_:for:)):
(HTTPServerCore.didReceive(_:)):
(HTTPServerCore.respondToRequests(on:)):
(HTTPServerCore.makeParameters(_:identity:verifier:)):
* Tools/TestWebKitAPI/Helpers/cocoa/HTTPServerRouting.swift: Added.
(statusCode):
(headerFields):
(behavior):
(headerFieldsFor304):
(HTTPResponseData.serialize(_:)):
(HTTPRequestComponentParser.path):
(HTTPRequestComponentParser.cookies):
(HTTPRequestComponentParser.authorization):
(HTTPRequestComponentParser.body):
(HTTPRequestComponentParser.isConditionalRequest):
(HTTPRequestComponentParser.headerValue(_:)):
(statusText(_:)):
* Tools/TestWebKitAPI/PlatformCocoa.cmake:
* Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* Tools/TestWebKitAPI/TestWebKitAPILibrary/module.modulemap:

Canonical link: https://commits.webkit.org/320993@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to