Upyun
Upyun Storage REST API requests signed with the UPYUN header scheme.
Signs the method, wire path, Date, and an optional Content-MD5 header; expires_in is not interpreted. Discovered CLI credentials require the first segment of the request's wire path to exactly equal the CLI session bucket on every signature, including cache hits. This is a local request-target check, not a server-side path-rewrite claim.
Get started
cargo add reqsign --features upyun
use reqsign::upyun::StaticCredentialProvider;
use reqsign::{default_context, upyun};
let ctx = default_context();
let signer = upyun::default_signer(ctx, "bucket")
.with_credential_provider(StaticCredentialProvider::new("operator", "password"));
// Build the request and choose the bucket endpoint in the caller.
let mut req = http::Request::put("https://v0.api.upyun.com/bucket/object.txt")
.body(())?
.into_parts()
.0;
signer.sign(&mut req, None).await?;
The default chain selects the session for bucket from the Upyun CLI (upx)
configuration at ~/.upx.cfg. A matching current session is preferred, then
the first session for that bucket. The discovered credential is scoped to that
bucket: every signature requires the first segment of the request's wire path
to exactly equal it, including when a cached credential is reused. This is a
local check of the request target and does not assume server-side path
rewriting. The file has no account or endpoint scope beyond the bucket. Install
StaticCredentialProvider directly, or push it in front of the default chain,
when credentials come from application configuration; explicit static
credentials are unscoped unless the caller sets a bucket.
The signer adds Date and Authorization. Set Content-MD5 before signing
when the request body should participate in the signature. The signed URI is
the request's wire path exactly as supplied; the signer does not decode,
normalize, or rebuild it. It does not create presigned URLs or token
credentials, and it does not send the request.
Credentials
Default credential chain
The default signer tries these sources in order and uses the first one that yields a credential — no configuration needed when any of them is present:
- Upyun CLI (upx) configuration (~/.upx.cfg, bucket-scoped)
Credential providers
Available ProvideCredential implementations. Construct any of them directly, reorder them, or compose them into your own chain — see Loading credentials:
UpxConfigCredentialProvider— Upyun CLI (upx) configuration (~/.upx.cfg, bucket-scoped)StaticCredentialProvider— Static operator and password