Godot Version
3.5.3
Question
Hello, i am making some programs using C++. I wonder that which library did Godot use for HTTP Requests for Web. Thanks.
3.5.3
Hello, i am making some programs using C++. I wonder that which library did Godot use for HTTP Requests for Web. Thanks.
No library, just a tcp connection.
HTTP requests are in a plain text format with three parts, the request line, headers, and the message body. Here’s an example of a HTTP request, each line ends with a carrage return and line feed (CRLF) which can be produced in code by "\r\n"
GET / HTTP/1.1
Host: example.com
Accept-Language: en-US,en
Connection: keep-alive
The first line must be the request line. It contains the method “GET”, the url “/” and the HTTP version “HTTP/1.1”. Web browsers often leave off the first /
but it is standard when making requests, if you wanted a specific image the requested url would be /image.png
Then multiple headers are provided, each in a key-value pair like a dictionary type in GDScript. A :
separator between the key and value, a CRLF between each header. Finally when we are done with headers we feed two CRLF to start the body.
Notice there isn’t a body in this request, most “GET” requests do not send a body. If we were uploading some data then we could use a “POST” request with some body after the headers.
POST /forum HTTP/1.1
Host: example.com
Content-Type: application/x-www-form-urlencoded
Content-Length: 37
post=This%20is%20my%20post%20contents
RFC 2616, section 5 covers requests format