| 1 |
:mod:`mozproxy` --- Provides an HTTP proxy |
| 2 |
========================================== |
| 3 |
|
| 4 |
Mozproxy let you launch an HTTP proxy when we need to run tests against |
| 5 |
third-part websites in a reliable and reproducible way. |
| 6 |
|
| 7 |
Mozproxy provides an interface to a proxy software, and the currently |
| 8 |
supported backend is **mitmproxy** for Desktop and Android. |
| 9 |
|
| 10 |
Mozproxy is used by Raptor to run performance test without having to interact |
| 11 |
with the real web site. |
| 12 |
|
| 13 |
Mozproxy provide a function that returns a playback class. The usage pattern is |
| 14 |
|
| 15 |
.. rstcheck: ignore-languages=python |
| 16 |
.. code-block:: python |
| 17 |
|
| 18 |
from mozproxy import get_playback |
| 19 |
|
| 20 |
config = {'playback_tool': 'mitmproxy'} |
| 21 |
pb = get_playback(config) |
| 22 |
pb.start() |
| 23 |
try: |
| 24 |
# do your test |
| 25 |
finally: |
| 26 |
pb.stop() |
| 27 |
|
| 28 |
**config** is a dict with the following options: |
| 29 |
|
| 30 |
- **playback_tool**: name of the backend. can be "mitmproxy", "mitmproxy-android" |
| 31 |
- **playback_version**: playback tool version |
| 32 |
- **playback_files**: playback recording path/manifest/URL |
| 33 |
- **binary**: path of the browser binary |
| 34 |
- **obj_path**: build dir |
| 35 |
- **platform**: platform name (provided by mozinfo.os) |
| 36 |
- **run_local**: if True, the test is running locally. |
| 37 |
- **app**: tested app. Can be "firefox", "geckoview", "refbrow", "fenix" or "firefox" |
| 38 |
- **host**: hostname for the policies.json file |
| 39 |
- **local_profile_dir**: profile dir |
| 40 |
|
| 41 |
|
| 42 |
Supported environment variables: |
| 43 |
|
| 44 |
- **MOZPROXY_DIR**: directory used by mozproxy for all data files, set by mozproxy |
| 45 |
- **MOZ_UPLOAD_DIR**: upload directory path |
| 46 |
- **GECKO_HEAD_REPOSITORY**: used to find the certutils binary path from the CI |
| 47 |
- **GECKO_HEAD_REV**: used to find the certutils binary path from the CI |
| 48 |
- **HOSTUTILS_MANIFEST_PATH**: used to find the certutils binary path from the CI |