On 11/8/22 09:38, Daniel Stenberg via curl-library wrote:
Hello all!

I just want to highlight Stefan Eissing's work in progress that looks like it might become one of the largest PRs in a long time:

  https://github.com/curl/curl/pull/9855

We call the concept "connection filters" and it is a new way for libcurl internals to handle data over connections. Each filter is a stage in a data pipeline. TLS handling is a filter, a SOCKS proxy is, HTTP/2 is and so on.

Coincidence or not, I have a stalled project of the same kind. It was an idle work and far from mature. I called it "stomhaxx" in reference to the curl project origin and a mechanism similar to ruminants' digestive tract :-)

Something I noticed about this concept is that it easily copies data from a buffer to another if not designed carefully. That is why I provided two kind of input methods: read() that moves data to a buffer and get() that keeps data in place and returns a pointer and a length. The get() method is preferred between the different stomhaxx. Each of the stomaxx can then transform, insert or delete data in the flow. This also reduces the buffer allocation needs.

IMO, such an interface should also be made available on the caller's side: its own stage of stomhaxx can be designed and stacked to its side of the flow. In addition, providing a way to connect the application to curl with this feature is much more powerful than our current memory/file/callback interfaces (those are provided as "mouth" stomhaxx). Some useful user side stomhaxx can be provided too, like base64 transform, quoted-printable encoding, line end or tab transformation, data compression/expansion, etc.

I also dreamed of a mouth stomhaxx that accesses another curl handle...

From what I've seen in Stephan's PR, SSL and proxy are mainly targetted now. In the future, this feature could also be used to implement SASL data encryption that we do not support yet or replace mime composing. I also think of tiny things like the dotted-line transformation in mails.

Although not complete and not yet connected to curl itself, I can send the stomhaxx code in its current state here if someone is interested in looking at it.

Patrick

--
Unsubscribe: https://lists.haxx.se/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html
  • connection filters Daniel Stenberg via curl-library
    • Re: connection filters Patrick Monnerat via curl-library

Reply via email to