README.http2 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. HTTP2 with libcurl
  2. Spec: http://tools.ietf.org/html/draft-ietf-httpbis-http2
  3. Build prerequisites
  4. - nghttp2
  5. - OpenSSL, NSS, GnutTLS or PolarSSL with a new enough version
  6. nghttp2 (https://github.com/tatsuhiro-t/nghttp2)
  7. libcurl uses this 3rd party library for the low level protocol handling
  8. parts. The reason for this is that HTTP2 is much more complex at that layer
  9. than HTTP1.1 (which we implement on our own) and that nghttp2 is an already
  10. existing and well functional library.
  11. Right now, nghttp2 implements http2 draft-14
  12. We require at least version 0.6.0
  13. Over an http:// URL
  14. If CURLOPT_HTTP_VERSION is set to CURL_HTTP_VERSION_2, libcurl will include
  15. an upgrade header in the initial request to the host to allow upgrading to
  16. http2.
  17. Possibly we can later introduce an option that will cause libcurl to fail if
  18. not possible to upgrade. Possibly we introduce an option that makes libcurl
  19. use http2 at once over http://
  20. Over an https:// URL
  21. If CURLOPT_HTTP_VERSION is set to CURL_HTTP_VERSION_2, libcurl will use ALPN
  22. (or NPN) to negotiate which protocol to continue with. Possibly introduce an
  23. option that will cause libcurl to fail if not possible to use http2.
  24. Consider options to explicitly disable ALPN and/or NPN.
  25. ALPN is the TLS extension that http2 is expected to use. The NPN extension
  26. is for a similar purpose, was made prior to ALPN and is used for SPDY so
  27. early http2 servers are implemented using NPN before ALPN support is
  28. widespread.
  29. SSL libs
  30. The challenge is the ALPN and NPN support and all our different SSL
  31. backends. You may need a fairly updated SSL library version for it to
  32. provide the necessary TLS features. Right now we support:
  33. OpenSSL: ALPN and NPN
  34. NSS: ALPN and NPN
  35. GnuTLS: ALPN
  36. PolarSSL: ALPN
  37. Alt-Svc
  38. Alt-Svc is a suggested new header with a corresponding frame (ALTSVC) in
  39. http2 that tells the client about an alternative "route" to the same content
  40. for the same origin server that you get the response from. A browser or
  41. long-living client can use that hint to create a new connection
  42. asynchronously. For libcurl, we may introduce a way to bring such clues to
  43. the applicaton and/or let a subsequent request use the alternate route
  44. automatically.
  45. Applications
  46. We hide http2's binary nature and convert received http2 traffic to headers
  47. in HTTP 1.1 style. This allows applications to work unmodified.
  48. curl tool
  49. curl offers the --http2 command line option to enable use of http2
  50. To consider:
  51. - How to tell libcurl when using the multi interface that all or some of the
  52. handles are allowed to re-use the same physical connection. Can we just
  53. re-use existing pipelining logic?