pokeb / asi-http-request

Easy to use CFNetwork wrapper for HTTP requests, Objective-C, Mac OS X and iPhone
http://allseeing-i.com/ASIHTTPRequest
Other
5.78k stars 1.41k forks source link

When upload failed, there is no status code neither response header #359

Open MrArtichaut opened 11 years ago

MrArtichaut commented 11 years ago

Hi,

When an upload failed (a POST request with data in the body and the server returning a 400), there is no status code or response headers.

But its only for large data (more than 1M). For smaller data, it's work. I've digged in the source and find that when the server returns 400 before all data were sent, CFNetwork returns a kCFStreamEventErrorOccurred and from here, it's impossible to read other thing than the error in the read stream. But if the request failed after all data were sent, it send a kCFStreamEventEndEncountered and from here, status code and response readers can be read.