Merge pull request #33640 from mewin/http_head_request
Fix HTTP HEAD requests
This commit is contained in:
commit
6f38aeef52
2 changed files with 11 additions and 0 deletions
|
@ -173,6 +173,7 @@ Error HTTPClient::request_raw(Method p_method, const String &p_url, const Vector
|
||||||
}
|
}
|
||||||
|
|
||||||
status = STATUS_REQUESTING;
|
status = STATUS_REQUESTING;
|
||||||
|
head_request = p_method == METHOD_HEAD;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -228,6 +229,7 @@ Error HTTPClient::request(Method p_method, const String &p_url, const Vector<Str
|
||||||
}
|
}
|
||||||
|
|
||||||
status = STATUS_REQUESTING;
|
status = STATUS_REQUESTING;
|
||||||
|
head_request = p_method == METHOD_HEAD;
|
||||||
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
|
@ -269,6 +271,7 @@ void HTTPClient::close() {
|
||||||
|
|
||||||
connection.unref();
|
connection.unref();
|
||||||
status = STATUS_DISCONNECTED;
|
status = STATUS_DISCONNECTED;
|
||||||
|
head_request = false;
|
||||||
if (resolving != IP::RESOLVER_INVALID_ID) {
|
if (resolving != IP::RESOLVER_INVALID_ID) {
|
||||||
|
|
||||||
IP::get_singleton()->erase_resolve_item(resolving);
|
IP::get_singleton()->erase_resolve_item(resolving);
|
||||||
|
@ -470,6 +473,12 @@ Error HTTPClient::poll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This is a HEAD request, we wont receive anything.
|
||||||
|
if (head_request) {
|
||||||
|
body_size = 0;
|
||||||
|
body_left = 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (body_size != -1 || chunked) {
|
if (body_size != -1 || chunked) {
|
||||||
|
|
||||||
status = STATUS_BODY;
|
status = STATUS_BODY;
|
||||||
|
@ -724,6 +733,7 @@ HTTPClient::HTTPClient() {
|
||||||
tcp_connection.instance();
|
tcp_connection.instance();
|
||||||
resolving = IP::RESOLVER_INVALID_ID;
|
resolving = IP::RESOLVER_INVALID_ID;
|
||||||
status = STATUS_DISCONNECTED;
|
status = STATUS_DISCONNECTED;
|
||||||
|
head_request = false;
|
||||||
conn_port = -1;
|
conn_port = -1;
|
||||||
body_size = -1;
|
body_size = -1;
|
||||||
chunked = false;
|
chunked = false;
|
||||||
|
|
|
@ -166,6 +166,7 @@ private:
|
||||||
bool ssl_verify_host;
|
bool ssl_verify_host;
|
||||||
bool blocking;
|
bool blocking;
|
||||||
bool handshaking;
|
bool handshaking;
|
||||||
|
bool head_request;
|
||||||
|
|
||||||
Vector<uint8_t> response_str;
|
Vector<uint8_t> response_str;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue