1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

[HTML5] Replace XMLHttpRequest with Fetch.

This has some advantages:
- Streaming/chunked response support.
- Broader headers support.
This commit is contained in:
Fabio Alessandrelli
2021-03-02 16:00:24 +01:00
parent 751a6f9a63
commit c01f35de12
6 changed files with 376 additions and 349 deletions

View File

@@ -30,24 +30,21 @@
// HTTPClient's additional private members in the javascript platform
Error prepare_request(Method p_method, const String &p_url, const Vector<String> &p_headers);
Error make_request(Method p_method, const String &p_url, const Vector<String> &p_headers, const uint8_t *p_body, int p_body_len);
static void _parse_headers(int p_len, const char **p_headers, void *p_ref);
int xhr_id;
int read_limit;
int response_read_offset;
Status status;
int js_id = 0;
int read_limit = 4096;
Status status = STATUS_DISCONNECTED;
String host;
int port;
bool use_tls;
String username;
String password;
int port = -1;
bool use_tls = false;
int polled_response_code;
String polled_response_header;
PoolByteArray polled_response;
int polled_response_code = 0;
Vector<String> response_headers;
Vector<uint8_t> response_buffer;
#ifdef DEBUG_ENABLED
bool has_polled;
uint64_t last_polling_frame;
uint64_t last_polling_frame = 0;
#endif