[swift-server-dev] Convert HTTPVersion to struct

Helge Heß me at helgehess.eu
Wed Jun 14 08:11:14 CDT 2017


On 14 Jun 2017, at 14:59, Paulo Faria <paulo at zewo.io> wrote:
> You're completely right we should care about HTTP 2.0 now. But let's do it one step at a time, or else we won't get things done. The current topic is the HTTPVersion type. So could you please give your feedback in the HTTPVersion thread about how the current proposal of HTTPversion fits with HTTP 2.0? We should go from lower abstractions to higher abstractions incrementally but definitely considering the upper abstractions. Let's keep focus and move on! 😊

I gave my feedback on the type in the this thread already. Struct is fine for me, tuple is OK too. I don’t actually care much as “The HTTP version should only matter for logging purposes”. If it comes with comparison operations and such, something is likely wrong with the API.


The only HTTP/2 specific note I have is this thing:

  From the HTTPRequest API design perspective there is a small
  change in that method/version are just headers in HTTP/2.
  I brought that up before.
  E.g. why does ‘method' deserve a special enum, but not
  content-type etc which is equally important for dispatching
  a request. Either approach is fine though.)

This affects the discussion as it may make sense to expose the
HTTPVersion as a regular header to mirror the new HTTP/2 setup
instead of basing the API on the old HTTP/0,1 model.
(I think either is fine, with a slight preference for going
 with the ‘future’)

Or in other words: Why struct or tuple, just keep it as a string
like the other headers.

If HTTPVersion is not exposed as a String but as a specific type,
that would then affect the way headers in general are handled
(and I’m very much in favour of NOT using strings for the common
 ones for various reasons).

hh

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 842 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <https://lists.swift.org/pipermail/swift-server-dev/attachments/20170614/db54338d/attachment.sig>


More information about the swift-server-dev mailing list