feat: support custom headers for Xray HTTP outbounds (#9690)

* feat: support custom headers for Xray HTTP outbounds

* feat: simplify HTTP outbound headers input

* feat: validate JSON syntax in HTTP headers

  Keep HTTP outbound headers stored as raw text, while validating
  header names and values against RFC 9110/9112 syntax. Support string
  arrays for multi-value headers, reject duplicate JSON header keys, and
  clarify the invalid header JSON message.

* feat: refactor HTTP header parsing into utility

* Simplify code

* Simplify code

* Update CoreConfigV2rayServiceTests.cs

---------

Co-authored-by: 2dust <31833384+2dust@users.noreply.github.com>
This commit is contained in:
006lp
2026-07-11 14:31:17 +08:00
committed by GitHub
parent 2c70b018ce
commit 88d59488fd
14 changed files with 225 additions and 6 deletions
+28 -1
View File
@@ -149,7 +149,7 @@ namespace ServiceLib.Resx {
return ResourceManager.GetString("Downloading", resourceCulture);
}
}
/// <summary>
/// 查找类似 Failed to convert configuration file 的本地化字符串。
/// </summary>
@@ -330,6 +330,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Please enter valid HTTP request headers JSON. 的本地化字符串。
/// </summary>
public static string InvalidHttpOutboundHeaders {
get {
return ResourceManager.GetString("InvalidHttpOutboundHeaders", resourceCulture);
}
}
/// <summary>
/// 查找类似 Invalid address (URL) 的本地化字符串。
/// </summary>
@@ -3222,6 +3231,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 HTTP headers 的本地化字符串。
/// </summary>
public static string TbHttpOutboundHeaders {
get {
return ResourceManager.GetString("TbHttpOutboundHeaders", resourceCulture);
}
}
/// <summary>
/// 查找类似 Port hopping interval 的本地化字符串。
/// </summary>
@@ -4986,6 +5004,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Custom HTTP outbound request headers as a JSON object with string or string array values. 的本地化字符串。
/// </summary>
public static string TipHttpOutboundHeaders {
get {
return ResourceManager.GetString("TipHttpOutboundHeaders", resourceCulture);
}
}
/// <summary>
/// 查找类似 *Default value raw 的本地化字符串。
/// </summary>