curl / Mailing Lists / curl-library / Single Mail
Buy commercial curl support. We help you work out your issues, debug your libcurl applications, use the API, port to new platforms, add new features and more. With a team lead by the curl founder Daniel himself.

Libcurl and WebSockets

From: Gavin D. Howard via curl-library <curl-library_at_lists.haxx.se>
Date: Tue, 07 Jan 2025 02:27:57 +0000

Hello,

I am looking to use libcurl for a VCS. I will use the HTTP client and
email protocols, as well as the URL parser on both ends because Daniel
said so. [1]

I also intend to use WebSockets, and one thing I noticed in the RFC is
that WebSockets are more symmetrical than HTTP. In fact, after the
upgrade portion, which I will put in my own code, the only difference I
could find is masking.

Since I need to use libcurl on the server for URL parsing, I want to use
libcurl for the server portion of WebSockets. Libcurl does have the raw
API, so I already can, but that would mean duplicating the WebSocket
parsing.

I was wondering if the server portion of WebSockets could be
implemented minus the upgrade. I'd love to do it myself; would it be
accepted if I did it up to the standards of the Curl project?

On that note, I know that no portions of server code for HTTP will not
be implemented [2], and I agree. That said, I do need an HTTP server.

I've read the RFCs and just for HTTP 1.1, it seems simple enough to
implement it if I break Postel's law and essentially only accept
well-formatted HTTP requests, or requests as generated by browsers and
libcurl. Would it be simple enough to do myself? I really don't want to
pull in a full server library.

As a note: one requirement of my server is that it will always be run
behind a reverse proxy, so I don't have to worry about TCP and other
complexities. So when I say "just for HTTP 1.1," I really do mean it: I
just need HTTP 1.1 request parsing and response generation. I think.

As experts in HTTP, could I do that myself without too much trouble?

Gavin D. Howard
Member and Manager
Yzena, LLC

PS: I would love to discuss design for the server portion of WebSockets,
but my first thought is to duplicate the current API to make the the use
more explicit.

[1]: https://daniel.haxx.se/blog/2022/01/10/dont-mix-url-parsers/
[2]: https://curl.se/docs/faq.html#Can_I_write_a_server_with_libcur
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
Received on 2025-01-07