mirror of https://github.com/axmolengine/axmol.git
Fix XmlHttpRequestTest parsing error of response header on iOS platform
This commit is contained in:
parent
ce0854847d
commit
be02233815
|
@ -43,6 +43,7 @@
|
|||
@property (readonly) NSInteger getDataTime;
|
||||
|
||||
@property (readonly) NSInteger responseCode;
|
||||
@property (readonly) NSString *statusString;
|
||||
|
||||
@property (strong) NSError *responseError;
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
@synthesize responseData;
|
||||
@synthesize getDataTime;
|
||||
@synthesize responseCode;
|
||||
@synthesize statusString;
|
||||
@synthesize responseError;
|
||||
@synthesize conn;
|
||||
@synthesize finish;
|
||||
|
@ -73,7 +74,10 @@
|
|||
responseHeader = [[httpResponse allHeaderFields] copy];
|
||||
|
||||
responseCode = httpResponse.statusCode;
|
||||
if (responseCode != 200)
|
||||
statusString = [[NSHTTPURLResponse localizedStringForStatusCode:responseCode] copy];
|
||||
if(responseCode == 200)
|
||||
statusString = @"OK";
|
||||
if (responseCode/100 != 2)
|
||||
{// something went wrong, abort the whole thing
|
||||
|
||||
[connection cancel];
|
||||
|
|
|
@ -279,6 +279,7 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
|||
|
||||
//handle response header
|
||||
NSMutableString *header = [NSMutableString new];
|
||||
[header appendFormat:@"HTTP/1.1 %ld %@\n", httpAsynConn.responseCode, httpAsynConn.statusString];
|
||||
for (id key in httpAsynConn.responseHeader)
|
||||
{
|
||||
[header appendFormat:@"%@: %@\n", key, [httpAsynConn.responseHeader objectForKey:key]];
|
||||
|
|
|
@ -116,7 +116,7 @@ void LuaMinXmlHttpRequest::_gotHeader(string header)
|
|||
pch = strtok (NULL, " ");
|
||||
mystream << pch;
|
||||
|
||||
pch = strtok (NULL, " ");
|
||||
pch = strtok (NULL, "\n");
|
||||
mystream << " " << pch;
|
||||
|
||||
_statusText = mystream.str();
|
||||
|
|
Loading…
Reference in New Issue