Hi,

I am working on an ATS plugin which receives HTTP request from a client and 
issues a new request to a server. It then has to wait for the response from the 
server. Once the response is received the plugin has to parse the body of the 
response. 
I am using TSHttpConnect for sending the request to the server, creating a 
write and read VIOs. Once the plugin gets TS_EVENT_VCONN_WRITE_COMPLETE 
(indicating the request was sent to the server) I set up TSVConnRead with 
INT64_MAX. 
The quest is: how can I tell that I read the whole body of the response from 
the vio before I pass it to my parser?
Testing TSVIONBytesGet and TSVIONTodoGet always return INT64_MAX (since this is 
the nbytes value passed to TSVconnRead). And I will never get the 
TS_EVENT_VCONN_READ_COMPLETE event. 

I see two possible ways to solve the problem and they both feel like I am 
missing something here:
1. Read the response from the read VIO, parse Content-Length header and then 
count the bytes read from the VIO, to ensure that the whole body was received, 
before I pass it to the parser. 
2. Since both the request and response sent to the server go through HttpSM - 
attach a transform to the response to read the body.

Please help,
Bianca


 Protected by Websense Hosted Email Security -- www.websense.com 

Reply via email to