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
e43ccc62
Commit
e43ccc62
authored
Apr 26, 2019
by
Honfika
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make OriginalUrl readonly.
Add a new property (RequestUriString) which can be overridden in user code
parent
7b5ee1ca
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
22 additions
and
7 deletions
+22
-7
HttpRequestWriter.cs
src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs
+1
-1
HttpWebClient.cs
src/Titanium.Web.Proxy/Http/HttpWebClient.cs
+1
-1
Request.cs
src/Titanium.Web.Proxy/Http/Request.cs
+17
-2
ResponseHandler.cs
src/Titanium.Web.Proxy/ResponseHandler.cs
+1
-1
HttpContinueClient.cs
....Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
+1
-1
HttpMessageParsing.cs
....Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
+1
-1
No files found.
src/Titanium.Web.Proxy/Helpers/HttpRequestWriter.cs
View file @
e43ccc62
...
@@ -23,7 +23,7 @@ namespace Titanium.Web.Proxy.Helpers
...
@@ -23,7 +23,7 @@ namespace Titanium.Web.Proxy.Helpers
internal
async
Task
WriteRequestAsync
(
Request
request
,
bool
flush
=
true
,
internal
async
Task
WriteRequestAsync
(
Request
request
,
bool
flush
=
true
,
CancellationToken
cancellationToken
=
default
)
CancellationToken
cancellationToken
=
default
)
{
{
await
WriteLineAsync
(
Request
.
CreateRequestLine
(
request
.
Method
,
request
.
OriginalUrl
,
request
.
HttpVersion
),
await
WriteLineAsync
(
Request
.
CreateRequestLine
(
request
.
Method
,
request
.
RequestUriString
,
request
.
HttpVersion
),
cancellationToken
);
cancellationToken
);
await
WriteAsync
(
request
,
flush
,
cancellationToken
);
await
WriteAsync
(
request
,
flush
,
cancellationToken
);
}
}
...
...
src/Titanium.Web.Proxy/Http/HttpWebClient.cs
View file @
e43ccc62
...
@@ -99,7 +99,7 @@ namespace Titanium.Web.Proxy.Http
...
@@ -99,7 +99,7 @@ namespace Titanium.Web.Proxy.Http
// prepare the request & headers
// prepare the request & headers
await
writer
.
WriteLineAsync
(
Request
.
CreateRequestLine
(
Request
.
Method
,
await
writer
.
WriteLineAsync
(
Request
.
CreateRequestLine
(
Request
.
Method
,
useUpstreamProxy
||
isTransparent
?
Request
.
OriginalUrl
:
Request
.
RequestUri
.
PathAndQuery
,
useUpstreamProxy
||
isTransparent
?
Request
.
RequestUriString
:
Request
.
RequestUri
.
PathAndQuery
,
Request
.
HttpVersion
),
cancellationToken
);
Request
.
HttpVersion
),
cancellationToken
);
var
headerBuilder
=
new
StringBuilder
();
var
headerBuilder
=
new
StringBuilder
();
...
...
src/Titanium.Web.Proxy/Http/Request.cs
View file @
e43ccc62
...
@@ -14,6 +14,8 @@ namespace Titanium.Web.Proxy.Http
...
@@ -14,6 +14,8 @@ namespace Titanium.Web.Proxy.Http
[
TypeConverter
(
typeof
(
ExpandableObjectConverter
))]
[
TypeConverter
(
typeof
(
ExpandableObjectConverter
))]
public
class
Request
:
RequestResponseBase
public
class
Request
:
RequestResponseBase
{
{
private
string
originalUrl
;
/// <summary>
/// <summary>
/// Request Method.
/// Request Method.
/// </summary>
/// </summary>
...
@@ -32,7 +34,20 @@ namespace Titanium.Web.Proxy.Http
...
@@ -32,7 +34,20 @@ namespace Titanium.Web.Proxy.Http
/// <summary>
/// <summary>
/// The original request Url.
/// The original request Url.
/// </summary>
/// </summary>
public
string
OriginalUrl
{
get
;
set
;
}
public
string
OriginalUrl
{
get
=>
originalUrl
;
internal
set
{
originalUrl
=
value
;
RequestUriString
=
value
;
}
}
/// <summary>
/// The request uri as it is in the HTTP header
/// </summary>
public
string
RequestUriString
{
get
;
set
;
}
/// <summary>
/// <summary>
/// Has request body?
/// Has request body?
...
@@ -140,7 +155,7 @@ namespace Titanium.Web.Proxy.Http
...
@@ -140,7 +155,7 @@ namespace Titanium.Web.Proxy.Http
get
get
{
{
var
sb
=
new
StringBuilder
();
var
sb
=
new
StringBuilder
();
sb
.
Append
(
$"
{
CreateRequestLine
(
Method
,
OriginalUrl
,
HttpVersion
)}{
ProxyConstants
.
NewLine
}
"
);
sb
.
Append
(
$"
{
CreateRequestLine
(
Method
,
RequestUriString
,
HttpVersion
)}{
ProxyConstants
.
NewLine
}
"
);
foreach
(
var
header
in
Headers
)
foreach
(
var
header
in
Headers
)
{
{
sb
.
Append
(
$"
{
header
.
ToString
()}{
ProxyConstants
.
NewLine
}
"
);
sb
.
Append
(
$"
{
header
.
ToString
()}{
ProxyConstants
.
NewLine
}
"
);
...
...
src/Titanium.Web.Proxy/ResponseHandler.cs
View file @
e43ccc62
...
@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy
...
@@ -92,7 +92,7 @@ namespace Titanium.Web.Proxy
// clear current response
// clear current response
await
args
.
ClearResponse
(
cancellationToken
);
await
args
.
ClearResponse
(
cancellationToken
);
var
httpCmd
=
Request
.
CreateRequestLine
(
args
.
HttpClient
.
Request
.
Method
,
var
httpCmd
=
Request
.
CreateRequestLine
(
args
.
HttpClient
.
Request
.
Method
,
args
.
HttpClient
.
Request
.
OriginalUrl
,
args
.
HttpClient
.
Request
.
HttpVersion
);
args
.
HttpClient
.
Request
.
RequestUriString
,
args
.
HttpClient
.
Request
.
HttpVersion
);
await
handleHttpSessionRequest
(
httpCmd
,
args
,
null
,
args
.
ClientConnection
.
NegotiatedApplicationProtocol
,
await
handleHttpSessionRequest
(
httpCmd
,
args
,
null
,
args
.
ClientConnection
.
NegotiatedApplicationProtocol
,
cancellationToken
,
args
.
CancellationTokenSource
);
cancellationToken
,
args
.
CancellationTokenSource
);
return
;
return
;
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpContinueClient.cs
View file @
e43ccc62
...
@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
...
@@ -20,7 +20,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
var
request
=
new
Request
var
request
=
new
Request
{
{
Method
=
"POST"
,
Method
=
"POST"
,
OriginalUrl
=
"/"
,
RequestUriString
=
"/"
,
HttpVersion
=
new
Version
(
1
,
1
)
HttpVersion
=
new
Version
(
1
,
1
)
};
};
request
.
Headers
.
AddHeader
(
KnownHeaders
.
Host
,
server
);
request
.
Headers
.
AddHeader
(
KnownHeaders
.
Host
,
server
);
...
...
tests/Titanium.Web.Proxy.IntegrationTests/Helpers/HttpMessageParsing.cs
View file @
e43ccc62
...
@@ -26,7 +26,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
...
@@ -26,7 +26,7 @@ namespace Titanium.Web.Proxy.IntegrationTests.Helpers
RequestResponseBase
request
=
new
Request
()
RequestResponseBase
request
=
new
Request
()
{
{
Method
=
method
,
Method
=
method
,
OriginalUrl
=
url
,
RequestUriString
=
url
,
HttpVersion
=
version
HttpVersion
=
version
};
};
while
(!
string
.
IsNullOrEmpty
(
line
=
reader
.
ReadLine
()))
while
(!
string
.
IsNullOrEmpty
(
line
=
reader
.
ReadLine
()))
...
...
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