Is it possible to implement the CONNECT HTTP method with the Snap framework?

60 views Asked by At

I'm looking into possibilities how to implement the CONNECT HTTP method that allows tunneling data over HTTP. However, I couldn't find a way how to implement bi-directional processing within one Snap request. The closest thing I found was transformRequestBody

transformRequestBodySource :: (forall a. Enumerator Builder IO a) -> Snap ()

but this only transforms request input into response output, while I need to process input and output simultaneously to relay data to the requested target resource.

1

There are 1 answers

0
Michael Snoyman On BEST ANSWER

I believe this is via escapeHttp. I discovered this by looking at the source for websockets-snap, which presumably is the right way to upgrade a connection.

For reference, in the WAI world this is handled via the responseRaw function.