July 2nd, 2009, 12:17 PM
HTTP File Upload, unable to retriev InputStream with Chunked encoding
I am going crazy with this. We have a server that supprots HTTP1.1 and Transfer-Encoding: chunked.
We have written a mobile app that uploads a file to the server. Due to low memory on the phone we do not want to buffer all data and send it in once erquest. Instead we want it to be streamed through.
We found out that Transfer-encoding: chunked does this. It actually works, we can see the network data being streamed.
The problem starts after the file has been sent. We are unable to retrieve the InputStream. After sometime it timesout throwing a SocketTimeoutException.
InputStream is = httpConn.getInputStream(); //This line causes the timeout.
It seems as if the server DOES NOT KNOW we are done sending the file? We read the documentation for chunked send and according to wikipedia we have to add a zero-size chunk at the end.
We have tried adding this but still we are getting this exception. Not sure if we tried it correctly though.
Can anyone please help? This is very urgent.
Click Here to Expand Forum to Full Width
This is a CodeGuru survey question.