mirror of https://github.com/axmolengine/axmol.git
Fix crash on the XmlHttpRequestTest for Lua and parsing error of response headers for HttpURLConnection
This commit is contained in:
parent
26a6502558
commit
832a87f5f0
|
@ -188,9 +188,13 @@ static int processTask(HttpRequest *request, NSString* requestType, void *stream
|
|||
}
|
||||
}
|
||||
|
||||
NSString* requestData = [NSString stringWithUTF8String:request->getRequestData()];
|
||||
NSData *postData = [requestData dataUsingEncoding:NSUTF8StringEncoding];
|
||||
[nsrequest setHTTPBody:postData];
|
||||
char* requestDataBuffer = request->getRequestData();
|
||||
if (nullptr != requestDataBuffer && 0 != strlen(requestDataBuffer))
|
||||
{
|
||||
NSString* requestData = [NSString stringWithUTF8String:requestDataBuffer];
|
||||
NSData *postData = [requestData dataUsingEncoding:NSUTF8StringEncoding];
|
||||
[nsrequest setHTTPBody:postData];
|
||||
}
|
||||
}
|
||||
|
||||
//read cookie propertities from file and set cookie
|
||||
|
|
|
@ -184,14 +184,14 @@ public class Cocos2dxHttpURLConnection
|
|||
return null;
|
||||
}
|
||||
|
||||
String header = null;
|
||||
String header = "";
|
||||
|
||||
for (Entry<String, List<String>> entry: headers.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (null == key) {
|
||||
header += listToString(entry.getValue(), ",");
|
||||
header += listToString(entry.getValue(), ",") + "\n";
|
||||
} else {
|
||||
header += key + ":" + listToString(entry.getValue(), ",");
|
||||
header += key + ":" + listToString(entry.getValue(), ",") + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue