prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Warn new users about the lazy creation of connections (when requests are expected to be served in the script fully and only)
  #### Problem Description
  The [example script](https://docs.mitmproxy.org/stable/addons-examples/#http-reply-from-proxy) for not sending any data to the server does not prevent mitmproxy from **establishing a connection** to the server.
  For which reason is said connection established when no data has to be sent to this host right away and possibly never in the future?
  I trusted mitmproxy to **not send _any_ data, as stated**, but I had to discover (the hard way) that **that's not the case**.
  I used mitmproxy in an environment where it required to stay silent, but it wasn't compliant.
  
  Could you please consider warning new users about this behavior?
  <strike>Is there an easy way to prevent establishing connections?
  Is it planned to do so on default in this case?</strike>
  *EDIT*:  Trying to prevent connections by rerouting the connection to a closed port killed the flow for the client. Routing to a different host with invalid certificate worked though, warning me in the event log and suggesting setting connection strategy to lazy and it worked.
  
  #### Steps to reproduce the behavior:
  1. Load the example script
  2. Have the client request examle.com
  3. View the event log
  
  #### System Information
  Mitmproxy: 9.0.1
  Python:    3.10.6
  OpenSSL:   OpenSSL 3.0.7 1 Nov 2022
  Platform:  Linux-5.15.0-71-generic-x86_64-with-glibc2.35
  
  
  
  </issue>
  <code>
  [start of examples/addons/http-reply-from-proxy.py]
  1 """Send a reply from the proxy without sending any data to the remote server."""
  2 from mitmproxy import http
  3 
  4 
  5 def request(flow: http.HTTPFlow) -> None:
  6     if flow.request.pretty_url == "http://example.com/path":
  7         flow.response = http.Response.make(
  8             200,  # (optional) status code
  9             b"Hello World",  # (optional) content
  10             {"Content-Type": "text/html"},  # (optional) headers
  11         )
  12
  [end of examples/addons/http-reply-from-proxy.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/examples/addons/http-reply-from-proxy.py b/examples/addons/http-reply-from-proxy.py
  --- a/examples/addons/http-reply-from-proxy.py
  +++ b/examples/addons/http-reply-from-proxy.py
  @@ -1,4 +1,4 @@
  -"""Send a reply from the proxy without sending any data to the remote server."""
  +"""Send a reply from the proxy without sending the request to the remote server."""
   from mitmproxy import http
  
verification_info: {"golden_diff": "diff --git a/examples/addons/http-reply-from-proxy.py b/examples/addons/http-reply-from-proxy.py\n--- a/examples/addons/http-reply-from-proxy.py\n+++ b/examples/addons/http-reply-from-proxy.py\n@@ -1,4 +1,4 @@\n-\"\"\"Send a reply from the proxy without sending any data to the remote server.\"\"\"\n+\"\"\"Send a reply from the proxy without sending the request to the remote server.\"\"\"\n from mitmproxy import http\n", "issue": "Warn new users about the lazy creation of connections (when requests are expected to be served in the script fully and only)\n#### Problem Description\r\nThe [example script](https://docs.mitmproxy.org/stable/addons-examples/#http-reply-from-proxy) for not sending any data to the server does not prevent mitmproxy from **establishing a connection** to the server.\r\nFor which reason is said connection established when no data has to be sent to this host right away and possibly never in the future?\r\nI trusted mitmproxy to **not send _any_ data, as stated**, but I had to discover (the hard way) that **that's not the case**.\r\nI used mitmproxy in an environment where it required to stay silent, but it wasn't compliant.\r\n\r\nCould you please consider warning new users about this behavior?\r\n<strike>Is there an easy way to prevent establishing connections?\r\nIs it planned to do so on default in this case?</strike>\r\n*EDIT*:  Trying to prevent connections by rerouting the connection to a closed port killed the flow for the client. Routing to a different host with invalid certificate worked though, warning me in the event log and suggesting setting connection strategy to lazy and it worked.\r\n\r\n#### Steps to reproduce the behavior:\r\n1. Load the example script\r\n2. Have the client request examle.com\r\n3. View the event log\r\n\r\n#### System Information\r\nMitmproxy: 9.0.1\r\nPython:    3.10.6\r\nOpenSSL:   OpenSSL 3.0.7 1 Nov 2022\r\nPlatform:  Linux-5.15.0-71-generic-x86_64-with-glibc2.35\r\n\r\n\n", "before_files": [{"content": "\"\"\"Send a reply from the proxy without sending any data to the remote server.\"\"\"\nfrom mitmproxy import http\n\n\ndef request(flow: http.HTTPFlow) -> None:\n    if flow.request.pretty_url == \"http://example.com/path\":\n        flow.response = http.Response.make(\n            200,  # (optional) status code\n            b\"Hello World\",  # (optional) content\n            {\"Content-Type\": \"text/html\"},  # (optional) headers\n        )\n", "path": "examples/addons/http-reply-from-proxy.py"}]}