(req *http.Request)
| 1517 | } |
| 1518 | |
| 1519 | func (h *hijacker) ModifyRequest(req *http.Request) error { |
| 1520 | if req.URL.Path == h.proxy.global.Devtools.HijackPath { |
| 1521 | // We need to serve the devtools bundle by hijacking the client-side |
| 1522 | // connection. As a result, this proxy will no longer be used for regular |
| 1523 | // HTTP requests (i.e. non-devtools paths). Some programs such as Python's |
| 1524 | // SimpleHTTPServer are single-threaded, which means they will be blocked |
| 1525 | // until the last open connection finishes. As a result, we must first |
| 1526 | // close the server-side connection before starting the Martian hijack. |
| 1527 | h.srv.Close() |
| 1528 | |
| 1529 | conn, brw, err := martian.NewContext(req).Session().Hijack() |
| 1530 | if err != nil { |
| 1531 | return fmt.Errorf("subtrace: failed to hijack devtools endpoint: %w", err) |
| 1532 | } |
| 1533 | h.proxy.global.Devtools.HandleHijack(req, conn, brw) |
| 1534 | } |
| 1535 | |
| 1536 | return nil |
| 1537 | } |
| 1538 | |
| 1539 | func (h *hijacker) RoundTrip(req *http.Request) (*http.Response, error) { |
| 1540 | event := h.proxy.global.Config.GetEventTemplate() |
nothing calls this directly
no test coverage detected