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
a4d42abf
Commit
a4d42abf
authored
Mar 22, 2016
by
justcoding121
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #57 from justcoding121/release
move header prepare method right after user callback
parents
9e3ec34b
c25bbb15
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
11 deletions
+14
-11
RequestHandler.cs
Titanium.Web.Proxy/RequestHandler.cs
+14
-11
No files found.
Titanium.Web.Proxy/RequestHandler.cs
View file @
a4d42abf
...
...
@@ -217,18 +217,12 @@ namespace Titanium.Web.Proxy
args
.
ProxySession
.
Request
.
RequestHeaders
.
Add
(
new
HttpHeader
(
header
[
0
],
header
[
1
]));
}
SetRequestHeaders
(
args
.
ProxySession
.
Request
.
RequestHeaders
,
args
.
ProxySession
);
var
httpRemoteUri
=
new
Uri
(!
IsHttps
?
httpCmdSplit
[
1
]
:
(
string
.
Concat
(
"https://"
,
args
.
ProxySession
.
Request
.
Host
,
httpCmdSplit
[
1
])));
args
.
IsHttps
=
IsHttps
;
if
(
args
.
ProxySession
.
Request
.
UpgradeToWebSocket
)
{
TcpHelper
.
SendRaw
(
clientStream
,
httpCmd
,
args
.
ProxySession
.
Request
.
RequestHeaders
,
httpRemoteUri
.
Host
,
httpRemoteUri
.
Port
,
args
.
IsHttps
);
Dispose
(
client
,
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
);
return
;
}
args
.
ProxySession
.
Request
.
RequestUri
=
httpRemoteUri
;
...
...
@@ -252,7 +246,15 @@ namespace Titanium.Web.Proxy
break
;
}
if
(
args
.
ProxySession
.
Request
.
UpgradeToWebSocket
)
{
TcpHelper
.
SendRaw
(
clientStream
,
httpCmd
,
args
.
ProxySession
.
Request
.
RequestHeaders
,
httpRemoteUri
.
Host
,
httpRemoteUri
.
Port
,
args
.
IsHttps
);
Dispose
(
client
,
clientStream
,
clientStreamReader
,
clientStreamWriter
,
args
);
return
;
}
PrepareRequestHeaders
(
args
.
ProxySession
.
Request
.
RequestHeaders
,
args
.
ProxySession
);
//construct the web request that we are going to issue on behalf of the client.
connection
=
connection
==
null
?
TcpConnectionManager
.
GetClient
(
args
.
ProxySession
.
Request
.
RequestUri
.
Host
,
args
.
ProxySession
.
Request
.
RequestUri
.
Port
,
args
.
IsHttps
)
...
...
@@ -314,7 +316,7 @@ namespace Titanium.Web.Proxy
clientStreamWriter
.
Flush
();
}
private
static
void
Set
RequestHeaders
(
List
<
HttpHeader
>
requestHeaders
,
HttpWebSession
webRequest
)
private
static
void
Prepare
RequestHeaders
(
List
<
HttpHeader
>
requestHeaders
,
HttpWebSession
webRequest
)
{
for
(
var
i
=
0
;
i
<
requestHeaders
.
Count
;
i
++)
{
...
...
@@ -322,12 +324,13 @@ namespace Titanium.Web.Proxy
{
case
"accept-encoding"
:
requestHeaders
[
i
].
Value
=
"gzip,deflate,zlib"
;
break
;
break
;
default
:
break
;
}
}
FixRequestProxyHeaders
(
requestHeaders
);
webRequest
.
Request
.
RequestHeaders
=
requestHeaders
;
}
...
...
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