Wolfgang Bumiller
9be9d4b6ab
http: support ALPN negotiated http2
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-03-28 11:19:56 +01:00
Wolfgang Bumiller
fe8b11eeec
http: concat! user agent instead of format!
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-01-15 11:17:57 +01:00
Fabian Grünbichler
39453abb8f
http: sync: drop unused &self parameter
...
these are just internal helpers, changing their signature is fine.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-03-07 09:30:13 +01:00
Fabian Grünbichler
6a1be173a6
http: sync: derive default user-agent from crate version
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-03-07 09:30:13 +01:00
Fabian Grünbichler
5ba9d9b2c2
http: sync: remove redundant calls for setting User-Agent
...
the requests are all created via the agent that already contains the user
agent, so this internal helper isn't needed anymore.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-03-07 09:30:13 +01:00
Fabian Grünbichler
d69fee254a
http: sync: set user-agent via ureq agent
...
this allows us to slim down our code, and once
https://github.com/algesten/ureq/pull/597 is merged upstream (and/or we update
to a version containing the fix) it also means the custom user agent is used
for requests to the proxy host, if one is configured.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2023-03-07 09:30:13 +01:00
Wolfgang Bumiller
10a3ab222b
http: move rate-limiting out of client feature
...
this can now be used separately
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-03-02 16:14:04 +01:00
Fabian Grünbichler
08a6d56eae
http: client_trait: make request body generic
...
like the response body, instead of hard-coding Read.
2022-09-07 09:25:47 +02:00
Fabian Grünbichler
891dcfda2f
http: add extra_headers to post
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
ec77785578
http: sync: add HttpClient for Box<dyn Read>
...
for use cases where the full request body is not available from the
start, or the response doesn't need to be fully read in one go.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
00f5eca155
http: make post() take Read
, not &str
...
for more flexibility.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
7863eff2a5
http: fix typo
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
da49b98d15
http: rename SimpleHttp to Client
...
so we have proxmox_http::client::Client for the async, hyper-based
client and proxmox_http::client::sync::Client for the sync, ureq-based
one.
this is a breaking change.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
7ffb895062
http: add "raw" sync client
...
and switch String one over to use it.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
9c444d7a94
http: add ureq-based sync client
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
f429fcb592
http: extend HttpClient trait
...
to allow get requests with extra headers (such as `Authorization`) and a
generic `request` fn to increase flexibility even more.
this is a breaking change.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Fabian Grünbichler
ab5d5b39f6
http: move SimpleHttpOptions to http-helpers feature
...
and rename it to HttpOptions, since it's not specific to the "Simple"
client at all.
this is a breaking change.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-09-07 09:17:45 +02:00
Mira Limbeck
a8a838754d
http: fix proxy authorization header to include type
...
and encode the username:password string as base64 [0]. This fixes the
error 407 issue when using proxy authentication [1].
[0] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Proxy-Authorization
[1] https://forum.proxmox.com/threads/checking-the-subscription-behind-a-proxy-fails.112063/
Signed-off-by: Mira Limbeck <m.limbeck@proxmox.com>
2022-07-21 12:54:59 +02:00
Wolfgang Bumiller
94d388b988
http: clippy fixups
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-07-20 13:31:58 +02:00
Fabian Grünbichler
bd1f9f103e
http: implement HttpClient for SimpleHttp
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-06-30 12:42:17 +02:00
Fabian Grünbichler
94456ee4b1
http: move TLS helper to client feature
...
it's only used there and pulls in hyper and tokio, which we don't
want/need in http-helpers.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-06-29 10:32:44 +02:00
Wolfgang Bumiller
0d30720907
http: clippy fixes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 10:14:33 +02:00
Thomas Lamprecht
0eeb0dd17c
http: rustfmt
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-04-10 12:41:21 +02:00
Wolfgang Bumiller
70142e607d
proxmox-http: drop 'mut' on specialized request methods
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-11 08:56:34 +01:00
Wolfgang Bumiller
c609a58086
doc fixups
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-02 14:14:09 +01:00
Wolfgang Bumiller
179515c5b2
http: clippy fixes
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-12-07 11:45:52 +01:00
Dietmar Maurer
82245339b8
use new proxmox-sys 0.2.0 for all crates
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-24 10:00:38 +01:00
Dietmar Maurer
81e959548b
proxmox-http: impl RateLimiterVec
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-15 11:01:03 +01:00
Dietmar Maurer
b9a1d62e47
proxmox-http: RateLimit - remove average_rate
...
Instead, add a method to return overall traffic.
2021-11-14 08:15:42 +01:00
Dietmar Maurer
13276cc619
proxmox-http: use repr(C) for RateLimiter
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-13 17:38:18 +01:00
Dietmar Maurer
8734d0c2f9
proxmox-http: use SharedRateLimit trait object for RateLimitedStream
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-13 17:38:10 +01:00
Dietmar Maurer
937d1a6095
proxmox-http: define a RateLimit trait
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-13 17:38:00 +01:00
Dietmar Maurer
2f221df863
RateLimiter: add update_rate method
2021-11-10 09:51:08 +01:00
Dietmar Maurer
0c27d5da17
RateLimitedStream: implement peer_addr
2021-11-10 09:51:08 +01:00
Dietmar Maurer
e0a9982dd1
RateLimiter: avoid panic in time computations
2021-11-10 09:51:08 +01:00
Dietmar Maurer
e0305f724b
RateLimitedStream: allow periodic limiter updates
2021-11-10 09:51:08 +01:00
Dietmar Maurer
00ca0b7fae
HttpsConnector: use RateLimitedStream
...
So that we can limit used bandwidth.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-10 09:51:08 +01:00
Dietmar Maurer
ded24b3f4c
RateLimitedStream: implement poll_write_vectored
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-10 09:51:08 +01:00
Dietmar Maurer
c94ad247b1
Implement a rate limiting stream (AsyncRead, AsyncWrite)
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2021-11-10 09:51:08 +01:00
Wolfgang Bumiller
e0dcc337ac
rustfmt fixup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 12:25:49 +02:00
Wolfgang Bumiller
76c25a9612
add some more module level docs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:25:42 +02:00
Wolfgang Bumiller
c9b4a4f39b
uri: drop anyhow::Error and improve docs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:25:42 +02:00
Wolfgang Bumiller
ca9dd7ec36
reorganize crate
...
it's a 'http' utility crate
* the extra 'http' module is redundant
* the module name 'helpers' as a public path doesn't say
much about what it does
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:03:31 +02:00