summaryrefslogtreecommitdiff
path: root/core/io/http_client.cpp
diff options
context:
space:
mode:
authorsanikoyes <sanikoyes@163.com>2014-04-06 21:52:47 +0800
committersanikoyes <sanikoyes@163.com>2014-04-06 21:52:47 +0800
commit77a840e350668a9c80b1e63b9b73aac44221c53b (patch)
tree40d2115e639bdc72a61811ac4f2fb0f04ec8eb7f /core/io/http_client.cpp
parent14bbdcb139b35e6d206df1ab3176d34245b72329 (diff)
parentded365031ede27b7a6efef59bc886343f58d310b (diff)
Merge branch 'master' into hotfix-android-unicode-ime-input
Diffstat (limited to 'core/io/http_client.cpp')
-rw-r--r--core/io/http_client.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 1b53ee6104..f9da846844 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -97,8 +97,16 @@ Error HTTPClient::request( Method p_method, const String& p_url, const Vector<St
String request=String(_methods[p_method])+" "+p_url+" HTTP/1.1\r\n";
request+="Host: "+conn_host+":"+itos(conn_port)+"\r\n";
+ bool add_clen=p_body.length()>0;
for(int i=0;i<p_headers.size();i++) {
request+=p_headers[i]+"\r\n";
+ if (add_clen && p_headers[i].find("Content-Length:")==0) {
+ add_clen=false;
+ }
+ }
+ if (add_clen) {
+ request+="Content-Length: "+itos(p_body.utf8().length())+"\r\n";
+ //should it add utf8 encoding? not sure
}
request+="\r\n";
request+=p_body;