hc-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dmitry Potapov <potapo...@gmail.com>
Subject Full duplex NHttpReverseProxy?
Date Sun, 07 Dec 2014 19:50:33 GMT
Hello everyone,

I was trying to implement async handler which will be able to send
response prior to complete request consumption. For simplicity let's
assume that we are talking about NHttpReverseProxy (I'm actually
playing with it) example from the repo and we want to post entity
which won't fit the RAM and the response won't fit the RAM either. So,
proxy should work in full duplex mode, writing and reading bits of
data in both directions.

First issue I've encountered is the absence of HttpAsyncExchange
during the HttpAsycRequestHandler.processRequest(...) invocation. So,
I modified HttpAsyncService.requestReceived(...) so it will always
create HttpAsyncExchange at the very beginning of this function and
put it to context (not sure if this will work correct on Excpect:
100-Continue).

Another issue is that HttpAsyncService.responseReady(...) function
relies on pipeline entry presence. So, I've modified it a bit to set
message state to INIT even if pipeline entry is null and outgoing
entry is present. This looks like yet another crutch.

Anyway, these crutches allowed me to modify NHttpReverseProxy, so I'm
receiving some chunks of data from backend in full duplex mode. (After
that transfer hangs but I'm not sure that this is not a bug in
example).

So, the full set of cruthes can be found here:
https://gist.github.com/hirthwork/be613055884362ea68d3

My question is: are changes introduced into HttpAsyncService are legal
and won't break anything? Is there better way to send response during
request consumption?

-- 
Thanks in advance,
Dmitry

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@hc.apache.org
For additional commands, e-mail: dev-help@hc.apache.org


Mime
View raw message