<font size=2 face="sans-serif">In all honesty, the protocol isn't required
at all. </font>
<br>
<br><font size=2 face="sans-serif">The HTTPServer takes a HTTPRequestHandler,
but that's just a typedef to:</font>
<br><font size=2 face="sans-serif">&nbsp; &nbsp; &nbsp; &nbsp; (HTTPRequest,
HTTPResponseWriter) -&gt; HTTPBodyProcessing</font>
<br>
<br><font size=2 face="sans-serif">So we could remove both the HTTPRequestHandling
protocol and the HTTPRequestHandler typedef and rely on the closure being
defined in the HTTPServer API - which I think Helge a while ago but that
we couldn't do at the time as HTTPServer wasn't yet in the API.</font>
<br>
<br><font size=2 face="sans-serif">Chris<br>
</font>
<br>
<br>
<br>
<br><font size=1 color=#5f5f5f face="sans-serif">From: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">Andrew Dunn via swift-server-dev
&lt;swift-server-dev@swift.org&gt;</font>
<br><font size=1 color=#5f5f5f face="sans-serif">To: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">swift-server-dev@swift.org</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Date: &nbsp; &nbsp; &nbsp;
&nbsp;</font><font size=1 face="sans-serif">07/09/2017 16:05</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Subject: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">Re: [swift-server-dev]
HTTP API Review</font>
<br><font size=1 color=#5f5f5f face="sans-serif">Sent by: &nbsp; &nbsp;
&nbsp; &nbsp;</font><font size=1 face="sans-serif">swift-server-dev-bounces@swift.org</font>
<br>
<hr noshade>
<br>
<br>
<br><font size=3>IMHO both ‘HTTPRequestHandling' and ‘HTTPRequestHandler'
conform to the Swift API Design Guidelines, the ability to handle HTTP
requests is a capability after all.</font>
<br>
<br><font size=3>However, there’s just something about the name ‘HTTPRequestHandling'
which seems… off… Maybe because the word “handling” is a verb (in the
present-tense no less)? To make it an adjective it would have to be named
something like: “HandlesHTTPRequests”. But that would be in breach of
the style guidelines.</font>
<br>
<br><font size=3>Is it just me, or is the current usage of ‘HTTPRequestHandler’
identifier wasted on syntactic sugar for the relatively unlikely scenario
where a closure is provided to HTTPServing.start()? Perhaps the identifier
could be used for the protocol instead, and the method that takes a closure
could wrap the closure in a class implementing the protocol? Would look
something like so:</font>
<br>
<br><font size=3>&nbsp; &nbsp; public func start(port: Int = 0, handler:
HTTPRequestHandler) throws {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;try server.start(handler: handler)<br>
 &nbsp; &nbsp;}</font>
<br>
<br><font size=3>&nbsp; &nbsp; public func start(port: Int = 0, _ handlingClosure:
@escaping HTTPRequestHandlingClosure) throws {<br>
 &nbsp; &nbsp; &nbsp; &nbsp;try self.start(handler: HTTPRequestHandlingClosureWrapper(handlingClosure))<br>
 &nbsp; &nbsp;}</font>
<br>
<br><font size=3>Cheers,</font>
<br><font size=3>Andrew.</font><tt><font size=2>_______________________________________________<br>
swift-server-dev mailing list<br>
swift-server-dev@swift.org<br>
</font></tt><a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.swift.org_mailman_listinfo_swift-2Dserver-2Ddev&amp;d=DwIGaQ&amp;c=jf_iaSHvJObTbx-siA1ZOg&amp;r=YUviGsMNSCx-4Qgb5i8T6YSvdr1sG-dF4qEcHRkSKOQ&amp;m=JZMBdYZGUW6TogzveXi8ezRkhPmWqo-RsRvrk5-GZFw&amp;s=gq3AH1os5k29tRrsmvhPmWNOTHmJHWtHvpfLZFENEsM&amp;e="><tt><font size=2>https://urldefense.proofpoint.com/v2/url?u=https-3A__lists.swift.org_mailman_listinfo_swift-2Dserver-2Ddev&amp;d=DwIGaQ&amp;c=jf_iaSHvJObTbx-siA1ZOg&amp;r=YUviGsMNSCx-4Qgb5i8T6YSvdr1sG-dF4qEcHRkSKOQ&amp;m=JZMBdYZGUW6TogzveXi8ezRkhPmWqo-RsRvrk5-GZFw&amp;s=gq3AH1os5k29tRrsmvhPmWNOTHmJHWtHvpfLZFENEsM&amp;e=</font></tt></a><tt><font size=2>
<br>
</font></tt>
<br>
<br><font size=2 face="sans-serif"><br>
Unless stated otherwise above:<br>
IBM United Kingdom Limited - Registered in England and Wales with number
741598. <br>
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6
3AU<br>
</font>