diff options
author | Juan Linietsky <reduzio@gmail.com> | 2014-04-05 18:50:09 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2014-04-05 18:50:09 -0300 |
commit | b4969373b3475799d6b24cdffeda4659c37f0b8a (patch) | |
tree | 5cafdea68a5fe1f79c343c7cdf8def821e7f0b05 /core/io | |
parent | 9f33134c93ecbadda70e8eefc50563e29b2eb7f2 (diff) |
-HttpClient: ’Content-Length’ is added to httprequest if not provided in the headers and a body exists
-expressions in GDScript can take multiple lines if inside parenthesis (python-like)
-Added \ to force linebreaks to GDscript (python-like)
-added exclude objects from raycast
-fixed crashes
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/http_client.cpp | 8 |
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; |