| 42 | |
| 43 | @staticmethod |
| 44 | def configure(updated) -> None: |
| 45 | if "pac_url" in updated: |
| 46 | if ctx.options.pac_url is None: |
| 47 | UpstreamPac.pac_file = None |
| 48 | logging.info("No pac file specified") |
| 49 | else: |
| 50 | UpstreamPac.pac_file = pypac.get_pac( |
| 51 | url=ctx.options.pac_url, |
| 52 | allowed_content_types=[ |
| 53 | "application/x-ns-proxy-autoconfig ", |
| 54 | "application/x-javascript-config", |
| 55 | "text/html", |
| 56 | "text/plain", |
| 57 | ], |
| 58 | ) |
| 59 | if UpstreamPac.pac_file is None: |
| 60 | logging.error( |
| 61 | "Failed to load pac file from: %s", ctx.options.pac_url |
| 62 | ) |
| 63 | |
| 64 | @staticmethod |
| 65 | def proxy_address(flow: http.HTTPFlow) -> tuple[str, tuple[str, int]] | None: |