Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
T
Titanium-Web-Proxy
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Titanium-Web-Proxy
Commits
6b42b1b4
Commit
6b42b1b4
authored
Oct 06, 2015
by
justcoding121
Committed by
justcoding121
Oct 06, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix #16 issue
parent
434092ef
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
28 deletions
+39
-28
App.config
Titanium.Web.Proxy.Test/App.config
+4
-27
NetFramework.cs
Titanium.Web.Proxy/Helpers/NetFramework.cs
+33
-0
ProxyServer.cs
Titanium.Web.Proxy/ProxyServer.cs
+2
-1
No files found.
Titanium.Web.Proxy.Test/App.config
View file @
6b42b1b4
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<?
xml
version
=
"1.0"
encoding
=
"utf-8"
?>
<
configuration
>
<
configuration
>
<
configSections
>
<
startup
>
<
section
name
=
"unity"
type
=
"Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration"
/>
<
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.0,Profile=Client"
/>
<
section
name
=
"entityFramework"
type
=
"System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
requirePermission
=
"false"
/>
</
startup
>
</
configSections
>
</
configuration
>
<
connectionStrings
>
<
add
name
=
"SqlCELogConnectionString"
providerName
=
"System.Data.SqlServerCe.4.0"
connectionString
=
"Data Source=Log.sdf"
/>
<
add
name
=
"SqlCEEventsConnectionString"
providerName
=
"System.Data.SqlServerCe.4.0"
connectionString
=
"Data Source=Events.sdf"
/>
<
add
name
=
"SqlCEFilesConnectionString"
providerName
=
"System.Data.SqlServerCe.4.0"
connectionString
=
"Data Source=Files.sdf"
/>
<
add
name
=
"SqlServerLogConnectionString"
connectionString
=
"Data Source=.\SQLEXPRESS;Initial Catalog=ASXLog;Integrated Security=True;Enlist=False;"
providerName
=
"System.Data.SqlClient"
/>
<
add
name
=
"SqlServerEventsConnectionString"
connectionString
=
"Data Source=.\SQLEXPRESS;Initial Catalog=ASXEvents;Integrated Security=True;Enlist=False;"
providerName
=
"System.Data.SqlClient"
/>
<
add
name
=
"SqlServerFilesConnectionString"
connectionString
=
"Data Source=.\SQLEXPRESS;Initial Catalog=ASXFiles;Integrated Security=True;Enlist=False;"
providerName
=
"System.Data.SqlClient"
/>
<
add
name
=
"SqlServerSettingsConnectionString"
connectionString
=
"Data Source=.\SQLEXPRESS;Initial Catalog=ASXSettings;Integrated Security=True;Enlist=False;"
providerName
=
"System.Data.SqlClient"
/>
</
connectionStrings
>
<
entityFramework
>
<
defaultConnectionFactory
type
=
"System.Data.Entity.Infrastructure.SqlCeConnectionFactory, EntityFramework"
>
<
parameters
>
<
parameter
value
=
"System.Data.SqlServerCe.4.0"
/>
</
parameters
>
</
defaultConnectionFactory
>
<
providers
>
<
provider
invariantName
=
"System.Data.SqlClient"
type
=
"System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer"
/>
<
provider
invariantName
=
"System.Data.SqlServerCe.4.0"
type
=
"System.Data.Entity.SqlServerCompact.SqlCeProviderServices, EntityFramework.SqlServerCompact"
/>
</
providers
>
</
entityFramework
>
<
unity
configSource
=
"unity.debug.xml"
/>
<
startup
><
supportedRuntime
version
=
"v4.0"
sku
=
".NETFramework,Version=v4.0,Profile=Client"
/></
startup
></
configuration
>
Titanium.Web.Proxy/Helpers/NetFramework.cs
View file @
6b42b1b4
using
System
;
using
System
;
using
System.Collections.Generic
;
using
System.Collections.Generic
;
using
System.Linq
;
using
System.Linq
;
using
System.Net.Configuration
;
using
System.Reflection
;
using
System.Reflection
;
using
System.Text
;
using
System.Text
;
...
@@ -30,5 +31,37 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -30,5 +31,37 @@ namespace Titanium.Web.Proxy.Helpers
}
}
}
}
// Enable/disable useUnsafeHeaderParsing.
// See http://o2platform.wordpress.com/2010/10/20/dealing-with-the-server-committed-a-protocol-violation-sectionresponsestatusline/
public
static
bool
ToggleAllowUnsafeHeaderParsing
(
bool
enable
)
{
//Get the assembly that contains the internal class
Assembly
assembly
=
Assembly
.
GetAssembly
(
typeof
(
SettingsSection
));
if
(
assembly
!=
null
)
{
//Use the assembly in order to get the internal type for the internal class
Type
settingsSectionType
=
assembly
.
GetType
(
"System.Net.Configuration.SettingsSectionInternal"
);
if
(
settingsSectionType
!=
null
)
{
//Use the internal static property to get an instance of the internal settings class.
//If the static instance isn't created already invoking the property will create it for us.
object
anInstance
=
settingsSectionType
.
InvokeMember
(
"Section"
,
BindingFlags
.
Static
|
BindingFlags
.
GetProperty
|
BindingFlags
.
NonPublic
,
null
,
null
,
new
object
[]
{
});
if
(
anInstance
!=
null
)
{
//Locate the private bool field that tells the framework if unsafe header parsing is allowed
FieldInfo
aUseUnsafeHeaderParsing
=
settingsSectionType
.
GetField
(
"useUnsafeHeaderParsing"
,
BindingFlags
.
NonPublic
|
BindingFlags
.
Instance
);
if
(
aUseUnsafeHeaderParsing
!=
null
)
{
aUseUnsafeHeaderParsing
.
SetValue
(
anInstance
,
enable
);
return
true
;
}
}
}
}
return
false
;
}
}
}
}
}
Titanium.Web.Proxy/ProxyServer.cs
View file @
6b42b1b4
...
@@ -80,7 +80,8 @@ namespace Titanium.Web.Proxy
...
@@ -80,7 +80,8 @@ namespace Titanium.Web.Proxy
//Fix a bug in .NET 4.0
//Fix a bug in .NET 4.0
NetFrameworkHelper
.
URLPeriodFix
();
NetFrameworkHelper
.
URLPeriodFix
();
//useUnsafeHeaderParsing
NetFrameworkHelper
.
ToggleAllowUnsafeHeaderParsing
(
true
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment