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
2c8fdcf8
Commit
2c8fdcf8
authored
Jul 09, 2015
by
justcoding121
Committed by
justcoding121
Jul 09, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Project still in dev
parent
bfa34032
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
1 addition
and
90 deletions
+1
-90
README.md
README.md
+1
-90
No files found.
README.md
View file @
2c8fdcf8
...
...
@@ -4,95 +4,6 @@ Titanium
A light weight http(s) proxy server written in C#

Features
========
*
Supports HTTPS and all features of HTTP 1.1 (except pipelining)
*
Supports relaying of WebSockets
*
Supports script injection
*
Async using HTTPWebRequest class for better performance
Usage
=====
Refer the HTTP Proxy Server library in your project, look up Test project to learn usage.
Install by nuget:
Install-Package Titanium.Web.Proxy -Pre
After installing nuget package mark following files to be copied to app directory
*
makecert.exe
*
Titanium_Proxy_Test_Root.cer
Or install manually:
Add reference to
*
Titanium.Web.Proxy.dll
These files also should be in your application directory
*
Ionic.Zip.dll
*
makecert.exe
*
Titanium_Proxy_Test_Root.cer
Setup HTTP proxy:
```
csharp
// listen to client request & server response events
ProxyServer
.
BeforeRequest
+=
OnRequest
;
ProxyServer
.
BeforeResponse
+=
OnResponse
;
ProxyServer
.
EnableSSL
=
true
;
ProxyServer
.
SetAsSystemProxy
=
true
;
ProxyServer
.
Start
();
//wait here (You can use something else as a wait function, I am using this as a demo)
Console
.
Read
();
//Unsubscribe & Quit
ProxyServer
.
BeforeRequest
-=
OnRequest
;
ProxyServer
.
BeforeResponse
-=
OnResponse
;
ProxyServer
.
Stop
();
```
Sample request and response event handlers
```
csharp
public
void
OnRequest
(
object
sender
,
SessionEventArgs
e
)
{
//To cancel a request with a custom HTML content
//Filter URL
if
(
e
.
RequestURL
.
Contains
(
"somewebsite.com"
))
{
e
.
Ok
(
"<!DOCTYPE html><html><body><h1>Blocked</h1><p>website blocked.</p></body></html>"
);
}
}
public
void
OnResponse
(
object
sender
,
SessionEventArgs
e
)
{
if
(
e
.
ServerResponse
.
StatusCode
==
HttpStatusCode
.
OK
)
{
if
(
e
.
ServerResponse
.
ContentType
.
Trim
().
ToLower
().
Contains
(
"text/html"
))
{
//Get response body
string
responseHtmlBody
=
e
.
GetResponseHtmlBody
();
//Modify e.ServerResponse
responseHtmlBody
=
"<html><head></head><body>Response is modified!</body></html>"
;
//Set modifed response Html Body
e
.
SetRequestHtmlBody
(
responseHtmlBody
);
}
}
}
```
Future updates
============
*
Replace makecert.exe with other certificate generation APIs (like bouncy)
*
Support modification of web socket requests
*
Support HTTP 2.0 Once spec is ready
This project is still in progress. This will be updated once the project is stable.
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