| 474 | |
| 475 | @command.command("view.flows.create") |
| 476 | def create(self, method: str, url: str) -> None: |
| 477 | try: |
| 478 | req = http.Request.make(method.upper(), url) |
| 479 | except ValueError as e: |
| 480 | raise exceptions.CommandError("Invalid URL: %s" % e) |
| 481 | |
| 482 | c = connection.Client( |
| 483 | peername=("", 0), |
| 484 | sockname=("", 0), |
| 485 | timestamp_start=req.timestamp_start - 0.0001, |
| 486 | ) |
| 487 | s = connection.Server(address=(req.host, req.port)) |
| 488 | |
| 489 | f = http.HTTPFlow(c, s) |
| 490 | f.request = req |
| 491 | f.request.headers["Host"] = req.host |
| 492 | self.add([f]) |
| 493 | |
| 494 | @command.command("view.flows.load") |
| 495 | def load_file(self, path: mitmproxy.types.Path) -> None: |