gemini-server
gemini-server copied to clipboard
HTTP Requests Crash The Server
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.
Pull Request
I made PR #32 to address this.
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?
I was actually able to reproduce this with a gemini request as well. I'll look into it more
I think the error is in building the URL object. I'll fix this soon.
I pushed a change that catches a URL parsing failure. Does that fix your issue with HTTP requests as well?