Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

HTTP Requests Crash The Server #31

Open
matdombrock opened this issue May 10, 2023 · 5 comments
Open

HTTP Requests Crash The Server #31

matdombrock opened this issue May 10, 2023 · 5 comments

Comments

@matdombrock
Copy link

matdombrock commented May 10, 2023

Making an HTTP request to the server causes a crash.

node:internal/errors:478
    ErrorCaptureStackTrace(err);
    ^

TypeError [ERR_INVALID_URL]: Invalid URL
    at new NodeError (node:internal/errors:387:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:641:5)
    at Server.<anonymous> (/home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:174:37)
    at step (/home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:40:23)
    at Object.next (/home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:21:53)
    at /home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:15:71
    at new Promise (<anonymous>)
    at __awaiter (/home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:11:12)
    at TLSSocket.<anonymous> (/home/user/Lab/gemini/node_modules/gemini-server/dist/lib/index.js:116:54) {
  input: 'GET / HTTP/1.1',
  code: 'ERR_INVALID_URL'
}

I tried to handle this with middleware but it seems like its happening before the the middleware is called.

To clarify, I really dont know why people are making HTTP requests to port 1965 but they are. My server crashes from this daily.

@matdombrock
Copy link
Author

Pull Request

I made PR #32 to address this.

@jgkaplan
Copy link
Owner

I haven't been able to reproduce this issue. How are you making the HTTP request, and can you show me an example of your server file?

@jgkaplan
Copy link
Owner

I was actually able to reproduce this with a gemini request as well. I'll look into it more

@jgkaplan
Copy link
Owner

I think the error is in building the URL object. I'll fix this soon.

@jgkaplan
Copy link
Owner

I pushed a change that catches a URL parsing failure. Does that fix your issue with HTTP requests as well?

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

No branches or pull requests

2 participants