MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / request_raw

Method request_raw

scene/main/http_request.cpp:125–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125Error HTTPRequest::request_raw(const String &p_url, const Vector<String> &p_custom_headers, HTTPClient::Method p_method, const Vector<uint8_t> &p_request_data_raw) {
126 ERR_FAIL_COND_V(!is_inside_tree(), ERR_UNCONFIGURED);
127 ERR_FAIL_COND_V_MSG(requesting, ERR_BUSY, "HTTPRequest is processing a request. Wait for completion or cancel it before attempting a new one.");
128
129 if (timeout > 0) {
130 timer->stop();
131 timer->start(timeout);
132 }
133
134 method = p_method;
135
136 Error err = _parse_url(p_url);
137 if (err) {
138 return err;
139 }
140
141 headers = p_custom_headers;
142
143 if (accept_gzip) {
144 // If the user has specified an Accept-Encoding header, don't overwrite it.
145 if (!has_header(headers, "Accept-Encoding")) {
146 headers.push_back("Accept-Encoding: gzip, deflate");
147 }
148 }
149
150 request_data = p_request_data_raw;
151
152 requesting = true;
153
154 if (use_threads.is_set()) {
155 thread_done.clear();
156 thread_request_quit.clear();
157 client->set_blocking_mode(true);
158 thread.start(_thread_func, this);
159 } else {
160 client->set_blocking_mode(false);
161 err = _request();
162 if (err != OK) {
163 _defer_done(RESULT_CANT_CONNECT, 0, PackedStringArray(), PackedByteArray());
164 return ERR_CANT_CONNECT;
165 }
166
167 set_process_internal(true);
168 }
169
170 return OK;
171}
172
173void HTTPRequest::_thread_func(void *p_userdata) {
174 HTTPRequest *hr = static_cast<HTTPRequest *>(p_userdata);

Callers

nothing calls this directly

Calls 6

stopMethod · 0.45
startMethod · 0.45
push_backMethod · 0.45
is_setMethod · 0.45
clearMethod · 0.45
set_blocking_modeMethod · 0.45

Tested by

no test coverage detected