<html><body><p><font size="2">Helge,</font><br><br><font size="2">Can you review the following PRs and see if they cover some of the issues you raised about </font><br><br><font size="2">- `start` called `resume`, and `stop` `suspend` to match what GCD and Cocoa are doing</font><br><font size="2">- options class to be passed in `init` instead of `start` </font><br><br><a href="https://github.com/swift-server/http/pull/81"><font size="2">https://github.com/swift-server/http/pull/81</font></a><br><a href="https://github.com/swift-server/http/pull/82"><font size="2">https://github.com/swift-server/http/pull/82</font></a><br><br><font size="2">gelareh</font><br><br><img width="16" height="16" src="cid:1__=8FBB0B42DFC4707A8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Gelareh Taban---10/30/2017 04:50:15 PM---Good points on the existing design (without TLS). I worked w"><font size="2" color="#424282">Gelareh Taban---10/30/2017 04:50:15 PM---Good points on the existing design (without TLS). I worked with what was there, but in general I lik</font><br><br><font size="2" color="#5F5F5F">From: </font><font size="2">Gelareh Taban/Austin/IBM</font><br><font size="2" color="#5F5F5F">To: </font><font size="2">Helge Heß <me@helgehess.eu></font><br><font size="2" color="#5F5F5F">Cc: </font><font size="2">Helge Heß via swift-server-dev <swift-server-dev@swift.org></font><br><font size="2" color="#5F5F5F">Date: </font><font size="2">10/30/2017 04:50 PM</font><br><font size="2" color="#5F5F5F">Subject: </font><font size="2">Re: [swift-server-dev] HTTP API proposal for TLS integration</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><font size="2">Good points on the existing design (without TLS). I worked with what was there, but in general I like the idea of having an options class, which gets set in `init`. Kind of like what we did with TLSConfiguration. </font><br><br><font size="2">I can't comment on the parser/writer design and the multi-port, perhaps @Chris Bailey?</font><br><br><font size="2">gelareh</font><br><font size="2"> </font><br><br><br><img width="16" height="16" src="cid:1__=8FBB0B42DFC4707A8f9e8a93df938690918c8FB@" border="0" alt="Inactive hide details for Helge Heß via swift-server-dev ---10/30/2017 12:06:09 PM---Hi, a few things I noticed working on it:"><font size="2" color="#424282">Helge Heß via swift-server-dev ---10/30/2017 12:06:09 PM---Hi, a few things I noticed working on it:</font><br><br><font size="2" color="#5F5F5F">From: </font><font size="2">Helge Heß via swift-server-dev <swift-server-dev@swift.org></font><br><font size="2" color="#5F5F5F">To: </font><font size="2">Helge Heß via swift-server-dev <swift-server-dev@swift.org></font><br><font size="2" color="#5F5F5F">Date: </font><font size="2">10/30/2017 12:06 PM</font><br><font size="2" color="#5F5F5F">Subject: </font><font size="2">Re: [swift-server-dev] HTTP API proposal for TLS integration</font><br><font size="2" color="#5F5F5F">Sent by: </font><font size="2">swift-server-dev-bounces@swift.org</font><br><hr width="100%" size="2" align="left" noshade style="color:#8091A5; "><br><br><br><tt><font size="2">Hi,<br><br>a few things I noticed working on it:<br><br>- IMO the closure, ports and stuff should go into the `init`.<br><br>- The HTTPServing thing I don’t get at all. Why do we need this?<br>- Kinda the same for HTTPResponseWriter. (it is particularly weird that the writer is coupled with the parser in this implementation - they should be completely distinct).<br><br>- `start` should maybe be called `resume`, and `stop` `suspend` to match what GCD and Cocoa are doing.<br><br>- If we get tons of options we may rather want to add a<br><br>class HTTPServer {<br> class Options { // a class because subclasses may want to add<br> var certificate : ..<br> var port : ...<br> }<br>}<br><br>- Other things we need in the options: request/response logging.<br><br>- I was also wondering how we would want to handle multiple ports and in general addresses.<br>You would at least want to be able to listen on IPv6 …<br><br>I can see two options here:<br>- either create multiple server objects for each sockaddr_in<br>- or add listeners to the server objects<br> - this could be internal, but there needs to API to specify<br> what sockaddr_in’s you want to listen on.<br><br>hh<br><br>> On 30. Oct 2017, at 17:41, Gelareh Taban via swift-server-dev <swift-server-dev@swift.org> wrote:<br>> <br>> Hi all,<br>> <br>> As part of PR#78 for TLS integration into HTTP, </font></tt><tt><font size="2"><a href="https://github.com/swift-server/http/pull/78">https://github.com/swift-server/http/pull/78</a></font></tt><tt><font size="2">, I had to update the HTTP API and would like to ask for feedback.<br>> <br>> The TLS code sits in:<br>> </font></tt><tt><font size="2"><a href="https://github.com/gtaban/security.git">https://github.com/gtaban/security.git</a></font></tt><tt><font size="2"> // protocol definitions and data types<br>> </font></tt><tt><font size="2"><a href="https://github.com/gtaban/TLSService.git">https://github.com/gtaban/TLSService.git</a></font></tt><tt><font size="2"> // implementation using OpenSSL on Linux and SecureTransport on macOS<br>> <br>> The proposed HTTP API changes are in HTTPServing protocol:<br>> <br>> /// Start the HTTP server on the given `port`, using `handler` to process incoming requests<br>> - func start(port: Int, handler: @escaping HTTPRequestHandler) throws<br>> <br>> + func start(port: Int, tls: TLSConfiguration?, handler: @escaping HTTPRequestHandler) throws<br>> <br>> <br>> and HTTPServer class `start()` function:<br>> <br>> - public func start(port: Int = 0, handler: @escaping HTTPRequestHandler) throws {<br>> - try server.start(port: port, handler: handler)<br>> <br>> + public func start(port: Int = 0, tls: TLSConfiguration? = nil, handler: @escaping HTTPRequestHandler) throws {<br>> + try server.start(port: port, tlsConfig: tls, handler: handler)<br>> <br>> TLSConfiguration is a struct defined in:<br>> </font></tt><tt><font size="2"><a href="https://github.com/gtaban/security/blob/master/Sources/ServerSecurity/TLSConfiguration.swift">https://github.com/gtaban/security/blob/master/Sources/ServerSecurity/TLSConfiguration.swift</a></font></tt><tt><font size="2"><br>> <br>> which stores TLS parameters that are needed to configure a TLS connection. These include credentials (certificates and passwords) and cipher suites.<br>> <br>> <br>> There is a corresponding change in PoCSocket/PoCSocketSimpleServer.swift `start()` to pass in the configuration.<br>> <br>> The way that the proposed APIs would get uses can be seen in Tests/HTTPTests/TLSServerTests.swift.<br>> <br>> let config = createCASignedTLSConfig()<br>> <br>> // HTTP<br>> try server.start(port: 0, handler: simpleHelloWebApp.handle)<br>> <br>> // HTTPS<br>> try server.start(port: 0, tls: config, handler: simpleHelloWebApp.handle)<br>> <br>> <br>> Regards,<br>> Gelareh<br>> _______________________________________________<br>> swift-server-dev mailing list<br>> swift-server-dev@swift.org<br>> </font></tt><tt><font size="2"><a href="https://lists.swift.org/mailman/listinfo/swift-server-dev">https://lists.swift.org/mailman/listinfo/swift-server-dev</a></font></tt><tt><font size="2"><br><br>[attachment "signature.asc" deleted by Gelareh Taban/Austin/IBM] _______________________________________________<br>swift-server-dev mailing list<br>swift-server-dev@swift.org<br></font></tt><tt><font size="2"><a href="https://lists.swift.org/mailman/listinfo/swift-server-dev">https://lists.swift.org/mailman/listinfo/swift-server-dev</a></font></tt><tt><font size="2"><br></font></tt><br><br><br><BR>
</body></html>