curl-library
Adding QUIC support to curl
Date: Mon, 30 Oct 2017 14:48:39 -0400
Hello,
I have been thinking about how to add QUIC support to curl; in
particular, how to add QUIC support to curl using LSQUIC Client
Library [1]. I spent some time reading curl code and documentation
and I have a few high-level ideas that I'd like to present -- hopefully,
to get some feedback.
Why LSQUIC Client Library?
--------------------------
LSQUIC Client Library is an open-source QUIC implementation in C with
license similar to curl. Like curl, it is not tied to a particular
event loop. LSQUIC is functional now (it supports Google QUIC Q035
through Q041), unlike other QUIC implementations [2]. Support for IETF
QUIC is in the works.
QUIC uses UDP
-------------
This point is obvious, but it bears repeating: all but one (file:)
protocol that curl supports use TCP. It may mean that some of the curl
guts may need to be changed. Certainly, this is something to be on the
lookout for.
Upgrading HTTP connection to QUIC is complicated
------------------------------------------------
When HTTP/1.x is upgraded to HTTP/2, the same TCP connection is used.
Upgrading to QUIC would require opening a UDP socket and then replacing
the existing TCP socket with it once QUIC connection has been
established. It may make sense to not support HTTP/QUIC upgrade
functionality, at least initially. On the other hand, QUIC has no
scheme of its own [3], so there is no good way to tell curl to fetch
a resource using QUIC.
Connection cache considerations
-------------------------------
QUIC gives clients ability to keep a connection open using a PING frame.
Alternatively, we can say that since establishing QUIC connection is
cheap (0-RTT), curl should not go out of its way to keep a connection
open.
Extend curl SSL interface
-------------------------
curl's SSL interface will need to be extended to provide functions used
by QUIC crypto.
LSQUIC uses BoringSSL
---------------------
LSQUIC crypto code uses BoringSSL. It will need to be modified to
accept a list of function pointers, just like what curl does with its
SSL interface [4].
Kicking -- or ticking -- QUIC often enough
------------------------------------------
QUIC requires frequent "ticking" in order to maintain connection
performance. I am not sure how curl could support QUIC using the
easy interface -- the user would have to call *something* to drive
the QUIC connection along.
Plan of action
--------------
I think the best plan is to get something working, punting some of
the considerations above, and then make it more portable:
- Pretend that "httpq:" is a real scheme, at least to get
started.
- Use LSQUIC without bothering with abstracting SSL functions.
- Add new curl protocol handler for QUIC. (I do not know enough
yet to break this into subitems.)
1. https://github.com/litespeedtech/lsquic-client
2. https://github.com/quicwg/base-drafts/wiki/Implementations
3. https://github.com/quicwg/base-drafts/issues/253
4. https://github.com/curl/curl/blob/master/docs/INTERNALS.md#ssl
- Dmitri.
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-10-30