File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 33 * -------------------------------------------------------------
44 * File Name : chef.c
55 * File Authors : 曾奥然 <ccmywish@qq.com>
6- * Contributors : Nul None <nul@none.org >
6+ * Contributors : BingChunMoLi <bingchunmoli@bingchunmoli.com >
77 * Created On : <2025-08-09>
8- * Last Modified : <2025-08-22 >
8+ * Last Modified : <2025-08-27 >
99 *
1010 * chef DSL: for chefs (recipe makers) to define a target
1111 * ------------------------------------------------------------*/
@@ -374,3 +374,15 @@ chef_set_sources_last_updated (Target_t *target, char *date)
374374
375375 target -> sources_last_updated = xy_strdup (date );
376376}
377+
378+
379+ /**
380+ * @note 某些 target 需要修改 User-Agent
381+ * 由于单独测速 (chsrc measure) 的时候也需要进行此项修改,
382+ * 所以该函数不能仅仅放在 _setsrc() 里,而是应当放在 _prelude() 里
383+ */
384+ void
385+ chef_set_user_agent (char * user_agent )
386+ {
387+ ProgStatus .user_agent = user_agent ;
388+ }
Original file line number Diff line number Diff line change @@ -1112,11 +1112,6 @@ chsrc_determine_chgtype (ChgType_t type)
11121112 ProgStatus .chgtype = chsrc_in_reset_mode () ? ChgType_Reset : type ;
11131113}
11141114
1115- void
1116- chsrc_custom_user_agent (char * user_agent )
1117- {
1118- ProgStatus .user_agent = user_agent ;
1119- }
11201115
11211116#define MSG_EN_PUBLIC_URL "If the URL you specify is a public service, you are invited to contribute: chsrc issue"
11221117#define MSG_CN_PUBLIC_URL "若您指定的URL为公有服务,邀您参与贡献: chsrc issue"
Original file line number Diff line number Diff line change @@ -20,7 +20,9 @@ pl_java_prelude ()
2020 chef_allow_local_mode (this , CanNot , NULL , NULL );
2121 chef_forbid_english (this );
2222 chef_allow_user_define (this );
23- chsrc_custom_user_agent ("Maven/3.9.11" );
23+
24+ // HuaweiCDN 需要该项
25+ chef_set_user_agent ("Maven/3.9.11" );
2426
2527 def_sources_begin ()
2628 {& UpstreamProvider , "https://repo1.maven.org/maven2/" , DelegateToUpstream },
You can’t perform that action at this time.
0 commit comments