| 1 | # Trace HTTP Requests and Responses |
| 2 | |
| 3 | `goproxy-httpdump` starts an HTTP proxy on :8080. It handles explicit CONNECT |
| 4 | requests and traces them in a "db" directory created in the proxy working |
| 5 | directory. Each request type and headers are logged in a "log" file, while |
| 6 | their bodies are dumped in files prefixed with the request session identifier. |
| 7 | |
| 8 | Additionally, the example demonstrates how to: |
| 9 | - Log information asynchronously (see HttpLogger) |
| 10 | - Allow the proxy to be stopped manually while ensuring all pending requests |
| 11 | have been processed (in this case, logged). |
| 12 | |
| 13 | Start it in one shell: |
| 14 | |
| 15 | ```sh |
| 16 | goproxy-httpdump |
| 17 | ``` |
| 18 | |
| 19 | Fetch goproxy homepage in another: |
| 20 | |
| 21 | ```sh |
| 22 | http_proxy=http://127.0.0.1:8080 wget -O - \ |
| 23 | http://ripper234.com/p/introducing-goproxy-light-http-proxy/ |
| 24 | ``` |
| 25 | |
| 26 | A "db" directory should have appeared where you started the proxy, containing |
| 27 | two files: |
| 28 | - log: the request/response traces |
| 29 | - 1\_resp: the first response body |
| 30 |