diff options
author | Ariel Manzur <ariel@godotengine.org> | 2016-10-19 18:49:41 -0300 |
---|---|---|
committer | Ariel Manzur <ariel@godotengine.org> | 2016-10-19 18:49:41 -0300 |
commit | 1c2ac490cf157402cac7f9dbc2a293d0c922def8 (patch) | |
tree | 633e1dbc89b496f628c8c84319678ec35a5e5548 /core/io | |
parent | 1d45f35a4a190360fea74e51b66457efe44d3177 (diff) |
address type for http client
Diffstat (limited to 'core/io')
-rw-r--r-- | core/io/http_client.cpp | 7 | ||||
-rw-r--r-- | core/io/http_client.h | 2 |
2 files changed, 5 insertions, 4 deletions
diff --git a/core/io/http_client.cpp b/core/io/http_client.cpp index 2a831dd992..e3289b452c 100644 --- a/core/io/http_client.cpp +++ b/core/io/http_client.cpp @@ -29,8 +29,9 @@ #include "http_client.h" #include "io/stream_peer_ssl.h" +VARIANT_ENUM_CAST(IP_Address::AddrType); -Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host){ +Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_verify_host, IP_Address::AddrType p_addr_type){ close(); conn_port=p_port; @@ -62,7 +63,7 @@ Error HTTPClient::connect(const String &p_host, int p_port, bool p_ssl,bool p_ve status=STATUS_CONNECTING; } else { //is hostname - resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host); + resolving=IP::get_singleton()->resolve_hostname_queue_item(conn_host, p_addr_type); status=STATUS_RESOLVING; } @@ -635,7 +636,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","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true)); + ObjectTypeDB::bind_method(_MD("connect:Error","host","port","use_ssl","verify_host"),&HTTPClient::connect,DEFVAL(false),DEFVAL(true),DEFVAL(IP_Address::TYPE_ANY)); ObjectTypeDB::bind_method(_MD("set_connection","connection:StreamPeer"),&HTTPClient::set_connection); ObjectTypeDB::bind_method(_MD("get_connection:StreamPeer"),&HTTPClient::get_connection); ObjectTypeDB::bind_method(_MD("request_raw","method","url","headers","body"),&HTTPClient::request_raw); diff --git a/core/io/http_client.h b/core/io/http_client.h index 32d2e72101..ba464c34c7 100644 --- a/core/io/http_client.h +++ b/core/io/http_client.h @@ -165,7 +165,7 @@ public: //Error connect_and_get(const String& p_url,bool p_verify_host=true); //connects to a full url and perform request - Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true); + Error connect(const String &p_host,int p_port,bool p_ssl=false,bool p_verify_host=true, IP_Address::AddrType p_addr_type = IP_Address::TYPE_ANY); void set_connection(const Ref<StreamPeer>& p_connection); Ref<StreamPeer> get_connection() const; |