You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default plugin replaces POST body content with hardcoded`b'{"key": "modified"}'`
468
+
By default plugin replaces POST body content with hard-coded`b'{"key": "modified"}'`
465
469
and enforced `Content-Type: application/json`.
466
470
467
471
Verify the same using `curl -x localhost:8899 -d '{"key": "value"}' http://httpbin.org/post`
@@ -763,7 +767,7 @@ Modify plugin to your taste e.g. Allow specific IP addresses only.
763
767
764
768
### ModifyChunkResponsePlugin
765
769
766
-
This plugin demonstrate how to modify chunked encoded responses. In able to do so, this plugin uses `proxy.py` core to parse the chunked encoded response. Then we reconstruct the response using custom hardcoded chunks, ignoring original chunks received from upstream server.
770
+
This plugin demonstrate how to modify chunked encoded responses. In able to do so, this plugin uses `proxy.py` core to parse the chunked encoded response. Then we reconstruct the response using custom hard-coded chunks, ignoring original chunks received from upstream server.
767
771
768
772
Start `proxy.py` as:
769
773
@@ -784,14 +788,14 @@ plugin
784
788
* Closing connection 0
785
789
```
786
790
787
-
Modify `ModifyChunkResponsePlugin` to your taste. Example, instead of sending hardcoded chunks, parse and modify the original `JSON` chunks received from the upstream server.
791
+
Modify `ModifyChunkResponsePlugin` to your taste. Example, instead of sending hard-coded chunks, parse and modify the original `JSON` chunks received from the upstream server.
788
792
789
793
### CloudflareDnsResolverPlugin
790
794
791
795
This plugin uses `Cloudflare` hosted `DNS-over-HTTPS`[API](https://developers.cloudflare.com/1.1.1.1/encrypted-dns/dns-over-https/make-api-requests/dns-json) (json).
792
796
793
797
`DoH` mandates a HTTP2 compliant client. Unfortunately `proxy.py`
794
-
doesn't provide that yet, so we use a dependency. Install it:
798
+
does not provide that yet, so we use a dependency. Install it:
795
799
796
800
```console
797
801
❯ pip install "httpx[http2]"
@@ -811,7 +815,7 @@ Use `--cloudflare-dns-mode family` to also enable adult content protection too.
811
815
812
816
This plugin demonstrate how to use a custom DNS resolution implementation with `proxy.py`.
813
817
This example plugin currently uses Python's in-built resolution mechanism. Customize code
814
-
to your taste. Example, query your custom DNS server, implement DoH or other mechanisms.
818
+
to your taste. Example, query your custom DNS server, implement `DoH` or other mechanisms.
815
819
816
820
Start `proxy.py` as:
817
821
@@ -969,7 +973,7 @@ response from the server. Start `proxy.py` as:
969
973
--ca-signing-key-file ca-signing-key.pem
970
974
```
971
975
972
-
[](https://github.com/abhinavsingh/proxy.py#flags) Also provide explicit CA bundle path needed for validation of peer certificates. See `--ca-file` flag.
976
+
[](https://github.com/abhinavsingh/proxy.py#user-content-flags) Also provide explicit CA bundle path needed for validation of peer certificates. See `--ca-file` flag.
973
977
974
978
Verify TLS interception using `curl`
975
979
@@ -1042,7 +1046,8 @@ Important notes about TLS Interception with Docker container:
1042
1046
- Since `v2.2.0`, `proxy.py` docker container also ships with `openssl`. This allows `proxy.py`
1043
1047
to generate certificates on the fly for TLS Interception.
1044
1048
1045
-
- For security reasons, `proxy.py` docker container doesn't ship with CA certificates.
1049
+
- For security reasons, `proxy.py` docker container does not ship with
1050
+
CA certificates.
1046
1051
1047
1052
Here is how to start a `proxy.py` docker container
1048
1053
with TLS Interception:
@@ -1329,9 +1334,9 @@ if __name__ == '__main__':
1329
1334
1330
1335
# Unit testing with proxy.py
1331
1336
1332
-
## proxy.TestCase
1337
+
## `proxy.TestCase`
1333
1338
1334
-
To setup and teardown`proxy.py` for your Python `unittest` classes,
1339
+
To setup and tear down`proxy.py` for your Python `unittest` classes,
1335
1340
simply use `proxy.TestCase` instead of `unittest.TestCase`.
1336
1341
Example:
1337
1342
@@ -1346,10 +1351,10 @@ class TestProxyPyEmbedded(proxy.TestCase):
1346
1351
1347
1352
Note that:
1348
1353
1349
-
1.`proxy.TestCase` overrides `unittest.TestCase.run()` method to setup and teardown`proxy.py`.
1354
+
1.`proxy.TestCase` overrides `unittest.TestCase.run()` method to setup and tear down`proxy.py`.
1350
1355
2.`proxy.py` server will listen on a random available port on the system.
1351
1356
This random port is available as `self.PROXY.acceptors.flags.port` within your test cases.
1352
-
3. Only a single acceptor and worker is started by default (`--num-workers 1 --num-acceptors 1`) for faster setup and teardown.
1357
+
3. Only a single acceptor and worker is started by default (`--num-workers 1 --num-acceptors 1`) for faster setup and tear down.
1353
1358
4. Most importantly, `proxy.TestCase` also ensures `proxy.py` server
1354
1359
is up and running before proceeding with execution of tests. By default,
1355
1360
`proxy.TestCase` will wait for `10 seconds` for `proxy.py` server to start,
@@ -1373,13 +1378,15 @@ class TestProxyPyEmbedded(TestCase):
1373
1378
self.assertTrue(True)
1374
1379
```
1375
1380
1376
-
See [test_embed.py](https://github.com/abhinavsingh/proxy.py/blob/develop/tests/test_embed.py)
0 commit comments