diff options
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/SCsub | 2 | ||||
-rw-r--r-- | core/io/http_client.cpp | 15 | ||||
-rw-r--r-- | core/io/http_client.h | 2 | ||||
-rw-r--r-- | core/io/json.cpp | 12 |
4 files changed, 21 insertions, 10 deletions
diff --git a/core/io/SCsub b/core/io/SCsub index 5aecb4b915..3ff9b355a4 100644 --- a/core/io/SCsub +++ b/core/io/SCsub @@ -5,5 +5,3 @@ env.add_source_files(env.core_sources,"*.c") #env.core_sources.append("io/fastlz.c") Export('env') - - diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 24012660d2..58092efd4b 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -579,7 +579,7 @@ Error HTTPClient::_get_http_data(uint8_t* p_buffer, int p_bytes,int &r_received) void HTTPClient::_bind_methods() { - ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ObjectTypeDB::bind_method(_MD("request","method","url","headers","body"),&HTTPClient::request,DEFVAL(String())); ObjectTypeDB::bind_method(_MD("send_body_text","body"),&HTTPClient::send_body_text); @@ -601,6 +601,8 @@ void HTTPClient::_bind_methods() { ObjectTypeDB::bind_method(_MD("get_status"),&HTTPClient::get_status); ObjectTypeDB::bind_method(_MD("poll:Error"),&HTTPClient::poll); + ObjectTypeDB::bind_method(_MD("query_string_from_dict:String","fields"),&HTTPClient::query_string_from_dict); + BIND_CONSTANT( METHOD_GET ); BIND_CONSTANT( METHOD_HEAD ); @@ -689,6 +691,16 @@ void HTTPClient::set_read_chunk_size(int p_size) { read_chunk_size=p_size; } +String HTTPClient::query_string_from_dict(const Dictionary& p_dict) { + String query = ""; + Array keys = p_dict.keys(); + for (int i = 0; i < keys.size(); ++i) { + query += "&" + String(keys[i]).http_escape() + "=" + String(p_dict[keys[i]]).http_escape(); + } + query.erase(0, 1); + return query; +} + HTTPClient::HTTPClient(){ tcp_connection = StreamPeerTCP::create_ref(); @@ -710,4 +722,3 @@ HTTPClient::~HTTPClient(){ } - diff --git a/core/io/http_client.h b/core/io/http_client.h index 21281f38c5..b103dc43fc 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -192,6 +192,8 @@ public: Error poll(); + String query_string_from_dict(const Dictionary& p_dict); + HTTPClient(); ~HTTPClient(); }; diff --git a/core/io/json.cpp b/core/io/json.cpp index 14890abd26..22c99d0465 100644 --- a/core/io/json.cpp +++ b/core/io/json.cpp @@ -177,9 +177,6 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke case 'n': res=10; break; case 'f': res=12; break; case 'r': res=13; break; - case '\"': res='\"'; break; - case '\\': res='\\'; break; - case '/': res='/'; break; //wtf case 'u': { //hexnumbarh - oct is deprecated @@ -218,10 +215,13 @@ Error JSON::_get_token(const CharType *p_str, int &idx, int p_len, Token& r_toke } break; + //case '\"': res='\"'; break; + //case '\\': res='\\'; break; + //case '/': res='/'; break; default: { - - r_err_str="Invalid escape sequence"; - return ERR_PARSE_ERROR; + res = next; + //r_err_str="Invalid escape sequence"; + //return ERR_PARSE_ERROR; } break; } |