Can anybody tell me how to read the chunked data using Open SSL API,

I am writing a Man In The Middle application which intercepts the browser 
request and sends own request to the server , read the information from the 
server and puts it back to the browser. 

Now I am some what blocked in point where I need to read the Chunked Data from 
the server 

I have used the Open SSL function SSL_read in a loop which works until it get 0 
length chunked data, But some time I am not getting 0 sized data. Is there 
anything else to do. I am pasting my code snippet below 

  do
  {
   memset(pcBuff,'\0',iBufferSize); // Initializes the char * to null value 
   dwReadDataLen = SSL_read(pServerssl,pcBuff,iBufferSize); // Read data from 
the Server
   if(dwReadDataLen == 0 || dwReadDataLen == SOCKET_ERROR) 
        break;   
   SSL_write(pBrowserssl,pcBuff,dwReadDataLen); // Write back to the browser
   if(GetChunkedSize(pcBuff) == 0) // This function checks whether the last 
characters = \n\r and if found it retrieves the value 
        break;   
  } while(true);




Thanks, 
Raj 
Rajmohan SK 

Reply via email to