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.
|
This will spawn and execute a Request Block.
|
||||||
|
|
||||||
Syntax (expanded for readability):
|
Syntax (expanded for readability):
|
||||||
REQUEST METHOD "URL" [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
REQUEST METHOD "URL" [AcceptEncoding?] [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||||
[STANDARD / MULTIPART / BASICAUTH]
|
[STANDARD / MULTIPART / BASICAUTH]
|
||||||
[CONTENT "postdata"]
|
[CONTENT "postdata"]
|
||||||
[CONTENTTYPE "ctype"]
|
[CONTENTTYPE "ctype"]
|
||||||
|
|||||||
@@ -25,17 +25,24 @@
|
|||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="30" />
|
<RowDefinition Height="30" />
|
||||||
<RowDefinition Height="30" />
|
<RowDefinition Height="30" />
|
||||||
|
<RowDefinition Height="30" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<!-- Row 1 -->
|
||||||
<DockPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0">
|
<DockPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="0">
|
||||||
<Label Content="Method:"/>
|
<Label Content="Method:"/>
|
||||||
<ComboBox x:Name="methodCombobox" SelectionChanged="methodCombobox_SelectionChanged"/>
|
<ComboBox x:Name="methodCombobox" SelectionChanged="methodCombobox_SelectionChanged"/>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
<CheckBox Grid.Column="2" Grid.Row="0" Content="Auto Redirect" IsChecked="{Binding AutoRedirect}" VerticalContentAlignment="Center" />
|
<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="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="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"/>
|
<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>
|
</Grid>
|
||||||
|
|
||||||
<DockPanel Margin="0 5 0 0">
|
<DockPanel Margin="0 5 0 0">
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ KEYCHECK [BanOn4XX?] [BanOnToCheck?]
|
|||||||
]*
|
]*
|
||||||
</item>
|
</item>
|
||||||
<item name="REQUEST">
|
<item name="REQUEST">
|
||||||
REQUEST METHOD "URL" [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
REQUEST METHOD "URL" [AcceptEncoding?] [AutoRedirect?] [ReadResponseSource?] [ParseQuery?] [EncodeContent?]
|
||||||
[STANDARD / MULTIPART / BASICAUTH]
|
[STANDARD / MULTIPART / BASICAUTH]
|
||||||
[CONTENT "postdata"]
|
[CONTENT "postdata"]
|
||||||
[CONTENTTYPE "ctype"]
|
[CONTENTTYPE "ctype"]
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ namespace RuriLib
|
|||||||
/// <summary>Whether to URL encode the content before sending it.</summary>
|
/// <summary>Whether to URL encode the content before sending it.</summary>
|
||||||
public bool EncodeContent { get { return encodeContent; } set { encodeContent = value; OnPropertyChanged(); } }
|
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
|
// Multipart
|
||||||
private string multipartBoundary = "";
|
private string multipartBoundary = "";
|
||||||
/// <summary>The boundary that separates multipart contents.</summary>
|
/// <summary>The boundary that separates multipart contents.</summary>
|
||||||
@@ -253,6 +257,7 @@ namespace RuriLib
|
|||||||
.Token("REQUEST")
|
.Token("REQUEST")
|
||||||
.Token(Method)
|
.Token(Method)
|
||||||
.Literal(Url)
|
.Literal(Url)
|
||||||
|
.Boolean(AcceptEncoding, "AcceptEncoding")
|
||||||
.Boolean(AutoRedirect, "AutoRedirect")
|
.Boolean(AutoRedirect, "AutoRedirect")
|
||||||
.Boolean(ReadResponseSource, "ReadResponseSource")
|
.Boolean(ReadResponseSource, "ReadResponseSource")
|
||||||
.Boolean(ParseQuery, "ParseQuery")
|
.Boolean(ParseQuery, "ParseQuery")
|
||||||
@@ -346,7 +351,7 @@ namespace RuriLib
|
|||||||
var timeout = data.GlobalSettings.General.RequestTimeout * 1000;
|
var timeout = data.GlobalSettings.General.RequestTimeout * 1000;
|
||||||
request.IgnoreProtocolErrors = true;
|
request.IgnoreProtocolErrors = true;
|
||||||
request.AllowAutoRedirect = autoRedirect;
|
request.AllowAutoRedirect = autoRedirect;
|
||||||
request.EnableEncodingContent = true;
|
request.EnableEncodingContent = acceptEncoding;
|
||||||
request.ReadWriteTimeout = timeout;
|
request.ReadWriteTimeout = timeout;
|
||||||
request.ConnectTimeout = timeout;
|
request.ConnectTimeout = timeout;
|
||||||
request.KeepAlive = true;
|
request.KeepAlive = true;
|
||||||
@@ -449,6 +454,7 @@ namespace RuriLib
|
|||||||
var val = ReplaceValues(header.Value, data);
|
var val = ReplaceValues(header.Value, data);
|
||||||
|
|
||||||
if (replacedKey == "contenttype" && content != null) { continue; } // Disregard additional Content-Type headers
|
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 if (fixedNames.Contains(replacedKey)) request.AddHeader((HttpHeader)Enum.Parse(typeof(HttpHeader), replacedKey, true), val);
|
||||||
else request.AddHeader(key, val);
|
else request.AddHeader(key, val);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user