Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Un-catchable Malformed_HTTP_Response crash. #1667

Open
uhidontkno opened this issue Apr 26, 2024 · 1 comment
Open

Un-catchable Malformed_HTTP_Response crash. #1667

uhidontkno opened this issue Apr 26, 2024 · 1 comment

Comments

@uhidontkno
Copy link

System and Environment Information:

  • OS: debian bookworm
  • Runtime: Bun 1.1.3

Details on the Issue:
Periodically, my server will crash with the error along the lines of:

Malformed_HTTP_Response: Malformed_HTTP_Response fetching "http://192.168.0.9:8000/ports/list". For more information, pass `verbose: true` in the second argument to fetch()
 path: "http://192.168.0.9:8000/ports/list"

I've tried using try...catch but this is an issue with the package.

Reproduction:
Open up a Express server and add similar code to this:

  var proxy = HTTPproxy.createProxyServer({ ws: true });
  server.get("/ws/:node/*", function (req: Request, res: Response) {
    let url = req.url.replace(`/ws/${req.params.node}/`, "");
    req.url = url;
    try {
      proxy.web(req, res, {
        target: "http://" + endpoints[req.params.node].split("@")[1],
      });
    } catch {}
  });

At some point you'll encounter Malformed_HTTP_Response.

Note: I've looked at the code and couldnt find the use of fetch() anywhere, this could be an issue with a different package. I'm blaming this issue on this package for now though.

@uhidontkno
Copy link
Author

Workaround:
Restart your server in a loop on crash

while [ true ]; do
    bun run build
    bun run server/index.ts
    echo "[!] Server crashed! Restarting in 3 seconds..."
    echo "[i] Press CTRL + C to stop."
    sleep 3
done

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant