choonkeat / sotong
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Branch:
master
sotong /
| name | age | message | |
|---|---|---|---|
| |
README.rdoc | ||
| |
scripts/ | ||
| |
sotong.rb | ||
| |
vendor/ |
README.rdoc
Intro
"Sotong" is yet another Ruby proxy server.
Goals
- easily modify any HTTP response before reaching my browser
- quick edit-save-refresh cycle
- avoid installing mouseHole & reading its documents
Get Started
- Set your browser to use a proxy at localhost:12345
- Execute command:
$ ruby sotong.rb Proxy ready on 0.0.0.0:12345. Ctrl-C to quit.
Usage
To do more than just web proxy, add some arguments to the shell command:
ruby sotong.rb <url regexp> <ruby script> [<url regexp> <ruby script> [<url regexp> <ruby script> ...]]
Example
The following command will run "scripts/google.rb" for any URL matching "google-analytics"
$ ruby sotong.rb google-analytics scripts/google.rb URLs matching /google-analytics/ will trigger script "scripts/google.rb" Proxy ready on 0.0.0.0:12345. Ctrl-C to quit.
The following command will also run "scripts/nocache.rb" for any URL matching "swf"
$ ruby sotong.rb google-analytics scripts/google.rb swf scripts/nocache.rb URLs matching /google-analytics/ will trigger script "scripts/google.rb" URLs matching /swf/ will trigger script "scripts/nocache.rb" Proxy ready on 0.0.0.0:12345. Ctrl-C to quit.
See scripts/inspect.rb
Example 2
- Setup your browser to use proxy at 0.0.0.0:12345
- Run sotong with "scripts/highlight-my-tweets.rb"
$ ruby sotong.rb twitter.com/home scripts/highlight-my-tweets.rb URLs matching /twitter.com/home/ will trigger script "scripts/highlight-my-tweets.rb" Proxy ready on 0.0.0.0:12345. Ctrl-C to quit.
- Point your browser to twitter.com/home
- You should see your own tweets in yellow background.
This is just a simple illustration of what you can do
1. tweak even when server-side environment is not accessible 2. experiment without requiring firebug 3. not limited to document.ready, javascript changes. e.g. http headers: gzip? resize image?

