mirror of
https://github.com/2dust/v2rayN.git
synced 2026-11-16 17:35:01 +03:00
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:
@@ -256,6 +256,27 @@
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
Margin="{StaticResource Margin4}" />
|
||||
|
||||
<TextBlock
|
||||
x:Name="tbHttpHeaders"
|
||||
Grid.Row="3"
|
||||
Grid.Column="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="False"
|
||||
Text="{x:Static resx:ResUI.TbHttpOutboundHeaders}"
|
||||
ToolTip.Tip="{x:Static resx:ResUI.TipHttpOutboundHeaders}" />
|
||||
<views:JsonEditor
|
||||
x:Name="txtHttpHeadersJson"
|
||||
Grid.Row="3"
|
||||
Grid.Column="1"
|
||||
Width="400"
|
||||
MinHeight="100"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Center"
|
||||
IsVisible="False"
|
||||
ToolTip.Tip="{x:Static resx:ResUI.TipHttpOutboundHeaders}" />
|
||||
</Grid>
|
||||
<Grid
|
||||
x:Name="gridVLESS"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using v2rayN.Desktop.Base;
|
||||
using v2rayN.Desktop.Common;
|
||||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
@@ -54,8 +55,13 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||
break;
|
||||
|
||||
case EConfigType.SOCKS:
|
||||
gridSocks.IsVisible = true;
|
||||
break;
|
||||
|
||||
case EConfigType.HTTP:
|
||||
gridSocks.IsVisible = true;
|
||||
tbHttpHeaders.IsVisible = true;
|
||||
txtHttpHeadersJson.IsVisible = true;
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
@@ -148,9 +154,14 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||
break;
|
||||
|
||||
case EConfigType.SOCKS:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.HTTP:
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Password, v => v.txtId4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.SelectedSource.Username, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.HttpHeadersJson, v => v.txtHttpHeadersJson.Text).DisposeWith(disposables);
|
||||
break;
|
||||
|
||||
case EConfigType.VLESS:
|
||||
|
||||
Reference in New Issue
Block a user