mirror of
https://github.com/RubyMetric/chsrc
synced 2026-02-28 02:11:35 +08:00
fix: 设置user_agent 支持阿里云 测速
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user