rust-gamedig/crates/lib
Douile 723f2f5a06
http: Replace reqwest with ureq and add HTTPS support
ureq markets itself as a lightweight blocking HTTP client which might be
a good choice for rust-gamedig at the moment. However the main reason
for changing to ureq is that it allows setting a "resolver" function
which overrides the IP address to connect to. This is useful because it
allows us to pass a URL with the desired hostname without the HTTP
library doing an extra DNS lookup (this allows HTTPS to work when we
specify the exact IP and port to connect to external to the URL).

Other changes in this commit are:
- Feature gated things that depend on serde: this means that the eco
  game won't be available if the library is compiled without serde
- Added the TLS feature to enable TLS support in the HTTP library
- Added HTTPSettings to set the protocol (HTTP/HTTPS) and the hostname
- Setting a user-agent string on HTTP requests (allows the server to see
  what program is being used to query them)
- Store the address as a parsed Url so we don't re-parse it on every
  request
- Add a method to POST JSON data and parse response
- Renamed the request() method to get_json() in anticipation of a future
  method that will send a GET request and handle the raw bytes instead
  of using serde
- Improved documentation
2024-01-26 22:22:21 +00:00
..
examples feat: initial http and eco support 2024-01-02 01:43:36 +02:00
src http: Replace reqwest with ureq and add HTTPS support 2024-01-26 22:22:21 +00:00
Cargo.toml http: Replace reqwest with ureq and add HTTPS support 2024-01-26 22:22:21 +00:00