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.
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.