mirror of
https://github.com/openbullet/openbullet.git
synced 2023-10-21 07:33:42 -05:00
Accept-Encoding is now toggleable and can also be defined in Custom Headers when turned off.
This commit is contained in:
Binary file not shown.
@@ -271,7 +271,7 @@ KEYCHECK BanOnToCheck=False
|
||||
This will spawn and execute a Request Block.
|
||||
|
||||
Syntax (expanded for readability):
|
||||
REQUEST METHOD "URL" [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||
REQUEST METHOD "URL" [AcceptEncoding?] [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||
[STANDARD / MULTIPART / BASICAUTH]
|
||||
[CONTENT "postdata"]
|
||||
[CONTENTTYPE "ctype"]
|
||||
|
||||
@@ -25,17 +25,24 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="30" />
|
||||
<RowDefinition Height="30" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<!-- Row 1 -->
|
||||
<DockPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0">
|
||||
<Label Content="Method:"/>
|
||||
<ComboBox x:Name="methodCombobox" SelectionChanged="methodCombobox_SelectionChanged"/>
|
||||
</DockPanel>
|
||||
|
||||
<CheckBox Grid.Column="2" Grid.Row="0" Content="Auto Redirect" IsChecked="{Binding AutoRedirect}" VerticalContentAlignment="Center" />
|
||||
|
||||
<!-- Row 2 -->
|
||||
<CheckBox Grid.Column="0" Grid.Row="1" Content="Read Resp. Source" IsChecked="{Binding ReadResponseSource}" VerticalContentAlignment="Center" />
|
||||
<CheckBox Grid.Column="1" Grid.Row="1" Content="Parse GET Query" IsChecked="{Binding ParseQuery}" VerticalContentAlignment="Center"/>
|
||||
<CheckBox Grid.Column="2" Grid.Row="1" Content="Encode Content" IsChecked="{Binding EncodeContent}" VerticalContentAlignment="Center"/>
|
||||
|
||||
<!-- Row 3 -->
|
||||
<CheckBox Grid.Column="0" Grid.Row="2" Content="Accept-Encoding" IsChecked="{Binding AcceptEncoding}" VerticalContentAlignment="Center"/>
|
||||
</Grid>
|
||||
|
||||
<DockPanel Margin="0 5 0 0">
|
||||
|
||||
@@ -10,7 +10,7 @@ KEYCHECK [BanOn4XX?] [BanOnToCheck?]
|
||||
]*
|
||||
</item>
|
||||
<item name="REQUEST">
|
||||
REQUEST METHOD "URL" [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||
REQUEST METHOD "URL" [AcceptEncoding?] [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||
[STANDARD / MULTIPART / BASICAUTH]
|
||||
[CONTENT "postdata"]
|
||||
[CONTENTTYPE "ctype"]
|
||||
|
||||
@@ -111,6 +111,10 @@ namespace RuriLib
|
||||
/// <summary>Whether to URL encode the content before sending it.</summary>
|
||||
public bool EncodeContent { get { return encodeContent; } set { encodeContent = value; OnPropertyChanged(); } }
|
||||
|
||||
private bool acceptEncoding = true;
|
||||
/// <summary>Whether to automatically generate an Accept-Encoding header.</summary>
|
||||
public bool AcceptEncoding { get { return acceptEncoding; } set { acceptEncoding = value; OnPropertyChanged(); } }
|
||||
|
||||
// Multipart
|
||||
private string multipartBoundary = "";
|
||||
/// <summary>The boundary that separates multipart contents.</summary>
|
||||
@@ -253,6 +257,7 @@ namespace RuriLib
|
||||
.Token("REQUEST")
|
||||
.Token(Method)
|
||||
.Literal(Url)
|
||||
.Boolean(AcceptEncoding, "AcceptEncoding")
|
||||
.Boolean(AutoRedirect, "AutoRedirect")
|
||||
.Boolean(ReadResponseSource, "ReadResponseSource")
|
||||
.Boolean(ParseQuery, "ParseQuery")
|
||||
@@ -346,7 +351,7 @@ namespace RuriLib
|
||||
var timeout = data.GlobalSettings.General.RequestTimeout * 1000;
|
||||
request.IgnoreProtocolErrors = true;
|
||||
request.AllowAutoRedirect = autoRedirect;
|
||||
request.EnableEncodingContent = true;
|
||||
request.EnableEncodingContent = acceptEncoding;
|
||||
request.ReadWriteTimeout = timeout;
|
||||
request.ConnectTimeout = timeout;
|
||||
request.KeepAlive = true;
|
||||
@@ -449,6 +454,7 @@ namespace RuriLib
|
||||
var val = ReplaceValues(header.Value, data);
|
||||
|
||||
if (replacedKey == "contenttype" && content != null) { continue; } // Disregard additional Content-Type headers
|
||||
if (replacedKey == "acceptencoding" && acceptEncoding) { continue; } // Disregard additional Accept-Encoding headers
|
||||
// else if (fixedNames.Contains(replacedKey)) request.AddHeader((HttpHeader)Enum.Parse(typeof(HttpHeader), replacedKey, true), val);
|
||||
else request.AddHeader(key, val);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user