mirror of
https://github.com/clash-verge-rev/clash-verge-rev.git
synced 2026-01-29 00:35:38 +08:00
add support x-oss-meta-subscription-userinfo (#5234)
* add support x-oss-meta-subscription-userinfo * Update prfitem.rs match any subscription-userinfo * Update prfitem.rs 改为 ends_with 更好 * feat(config): enforce stricter header match for subscription usage --------- Co-authored-by: i18n <i18n.site@gmail.com> Co-authored-by: Slinetrac <realakayuki@gmail.com>
This commit is contained in:
@@ -297,18 +297,27 @@ impl PrfItem {
|
|||||||
let header = resp.headers();
|
let header = resp.headers();
|
||||||
|
|
||||||
// parse the Subscription UserInfo
|
// parse the Subscription UserInfo
|
||||||
let extra = match header.get("Subscription-Userinfo") {
|
let extra;
|
||||||
Some(value) => {
|
'extra: {
|
||||||
let sub_info = value.to_str().unwrap_or("");
|
for (k, v) in header.iter() {
|
||||||
Some(PrfExtra {
|
let key_lower = k.as_str().to_ascii_lowercase();
|
||||||
upload: help::parse_str(sub_info, "upload").unwrap_or(0),
|
// Accept standard custom-metadata prefixes (x-amz-meta-, x-obs-meta-, x-cos-meta-, etc.).
|
||||||
download: help::parse_str(sub_info, "download").unwrap_or(0),
|
if key_lower
|
||||||
total: help::parse_str(sub_info, "total").unwrap_or(0),
|
.strip_suffix("subscription-userinfo")
|
||||||
expire: help::parse_str(sub_info, "expire").unwrap_or(0),
|
.is_some_and(|prefix| prefix.is_empty() || prefix.ends_with('-'))
|
||||||
})
|
{
|
||||||
|
let sub_info = v.to_str().unwrap_or("");
|
||||||
|
extra = Some(PrfExtra {
|
||||||
|
upload: help::parse_str(sub_info, "upload").unwrap_or(0),
|
||||||
|
download: help::parse_str(sub_info, "download").unwrap_or(0),
|
||||||
|
total: help::parse_str(sub_info, "total").unwrap_or(0),
|
||||||
|
expire: help::parse_str(sub_info, "expire").unwrap_or(0),
|
||||||
|
});
|
||||||
|
break 'extra;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => None,
|
extra = None;
|
||||||
};
|
}
|
||||||
|
|
||||||
// parse the Content-Disposition
|
// parse the Content-Disposition
|
||||||
let filename = match header.get("Content-Disposition") {
|
let filename = match header.get("Content-Disposition") {
|
||||||
|
|||||||
Reference in New Issue
Block a user