summaryrefslogtreecommitdiff
path: root/core/io
diff options
context:
space:
mode:
Diffstat (limited to 'core/io')
-rw-r--r--core/io/config_file.cpp8
-rw-r--r--core/io/http_client.cpp11
-rw-r--r--core/io/json.cpp2
3 files changed, 13 insertions, 8 deletions
diff --git a/core/io/config_file.cpp b/core/io/config_file.cpp
index a01e935baa..fd20ec9404 100644
--- a/core/io/config_file.cpp
+++ b/core/io/config_file.cpp
@@ -127,6 +127,8 @@ Error ConfigFile::save(const String& p_path){
FileAccess *file = FileAccess::open(p_path,FileAccess::WRITE,&err);
if (err) {
+ if (file)
+ memdelete(file);
return err;
}
@@ -177,9 +179,11 @@ Error ConfigFile::load(const String& p_path) {
next_tag.fields.clear();
next_tag.name=String();
- err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL);
- if (err==ERR_FILE_EOF)
+ err = VariantParser::parse_tag_assign_eof(&stream,lines,error_text,next_tag,assign,value,NULL,true);
+ if (err==ERR_FILE_EOF) {
+ memdelete(f);
return OK;
+ }
else if (err!=OK) {
ERR_PRINTS("ConfgFile::load - "+p_path+":"+itos(lines)+" error: "+error_text);
memdelete(f);
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp
index 4d8cf121ee..19a7286dcf 100644
--- a/core/io/http_client.cpp
+++ b/core/io/http_client.cpp
@@ -248,7 +248,7 @@ Error HTTPClient::poll(){
status=STATUS_SSL_HANDSHAKE_ERROR;
return ERR_CANT_CONNECT;
}
- print_line("SSL! TURNED ON!");
+ //print_line("SSL! TURNED ON!");
connection=ssl;
}
status=STATUS_CONNECTED;
@@ -295,7 +295,7 @@ Error HTTPClient::poll(){
response_str.push_back(0);
String response;
response.parse_utf8((const char*)response_str.ptr());
- print_line("END OF RESPONSE? :\n"+response+"\n------");
+ //print_line("END OF RESPONSE? :\n"+response+"\n------");
Vector<String> responses = response.split("\n");
body_size=0;
chunked=false;
@@ -307,16 +307,17 @@ Error HTTPClient::poll(){
for(int i=0;i<responses.size();i++) {
String s = responses[i].strip_edges();
+ s = s.to_lower();
if (s.length()==0)
continue;
- if (s.begins_with("Content-Length:")) {
+ if (s.begins_with("content-length:")) {
body_size = s.substr(s.find(":")+1,s.length()).strip_edges().to_int();
body_left=body_size;
}
- if (s.begins_with("Transfer-Encoding:")) {
+ if (s.begins_with("transfer-encoding:")) {
String encoding = s.substr(s.find(":")+1,s.length()).strip_edges();
- print_line("TRANSFER ENCODING: "+encoding);
+ //print_line("TRANSFER ENCODING: "+encoding);
if (encoding=="chunked") {
chunked=true;
}
diff --git a/core/io/json.cpp b/core/io/json.cpp
index 45a97ed720..f9a8638d06 100644
--- a/core/io/json.cpp
+++ b/core/io/json.cpp
@@ -86,7 +86,7 @@ String JSON::_print_var(const Variant& p_var) {
s+="}";
return s;
};
- default: return "\""+String(p_var).c_escape()+"\"";
+ default: return "\""+String(p_var).json_escape()+"\"";
}