fix: 设置user_agent 支持阿里云 测速

This commit is contained in:
BingChunMoLi
2025-08-25 23:05:03 +08:00
parent ac50bd24cb
commit 7c9e351fc5
2 changed files with 10 additions and 7 deletions

View File

@@ -134,7 +134,7 @@ ProgStatus =
.leader_selected_index = -1,
.chgtype = ChgType_Auto,
.chsrc_run_faas = false,
.user_agent = NULL,
.user_agent = "chsrc",
};
@@ -644,12 +644,12 @@ measure_speed_for_url (void *url)
/**
* @note 我们用 —L因为部分链接会跳转到其他地方比如: RubyChina, npmmirror
*/
char *curl_cmd = xy_strcat (8, "curl -qsL ", ipv6,
char *curl_cmd = xy_strcat (10, "curl -qsL ", ipv6,
" -o ", os_devnull,
" -w \"%{http_code} %{speed_download}\" -m", time_sec,
" -A ", ProgStatus.user_agent, " ", url);
// chsrc_info (xy_2strjoin ("测速命令 ", curl_cmd));
// chsrc_note2 (xy_2strcat ("测速命令 ", curl_cmd));
char *curl_buf = xy_run (curl_cmd, 0);
return curl_buf;
}