That is very similar to what I ended up doing. I wasn't quite trying to 
hijack, but similar. Wish I had seen it before. :-)

Thanks for posting.

On Sunday, February 24, 2013 12:00:54 PM UTC+2, papandreou wrote:
>
> Hi Deitch,
>
> Take a look at https://github.com/papandreou/express-hijackresponse
>
> I haven't tried it in this exact setting, but I think it might work, even 
> without Express.
>
> Best regards,
> Andreas Lind Petersen (papandreou)
>
> On Wednesday, February 20, 2013 9:05:35 PM UTC+1, deitch wrote:
>>
>> Yeah, I should have been more clear, shouldn't I?
>>
>> Adding handling to node-http-proxy. It takes as its input the 
>> (request,response) pair from an http server callback handler. I want to 
>> wrap it so I can cache as well as some other processing.
>>
>> Normal http operation looks like this: 
>>
>> Client ----> Node
>>
>> Proxy operation looks like this
>>
>> Client ----> Node (running node-http-proxy) ----> Remote service
>>
>> What I am trying to do:
>>
>>
>> Client ----> Node (running my handler, passes to node-http-proxy) ----> 
>> Remote service
>>
>> It is easier to get in front of the request; I want to be able to 
>> instrument the response.
>>
>> Is that clearer?
>>
>>
>>
>> On Wednesday, February 20, 2013 9:24:21 PM UTC+2, greelgorke wrote:
>>>
>>> what exactly are you trying to do? of course you can always wrap 
>>> anything and observe actions etc., but it's not the problem you're trying 
>>> to solve in first place, right?
>>>
>>> Am Mittwoch, 20. Februar 2013 16:46:31 UTC+1 schrieb deitch:
>>>>
>>>> Is there any way to wrap http.serverResponse?
>>>>
>>>> E.g. I am using a module that takes as its input http.serverRequest and 
>>>> http.serverResponse. I want to be able to transparently catch any actions 
>>>> that the module performs on http.serverResponse so I can cache the 
>>>> statusCode, header and response.
>>>>
>>>> Do I have to override each and every major function - write, writeHead, 
>>>> end, setHeader, removeHeader - to do so? Is there a simpler way? I thought 
>>>> about looking for some 'end' type event, but that would miss all of the 
>>>> streaming data.
>>>>
>>>>
>>>>

-- 
-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to