uNetworking / uNetworking/uWebSockets.js
setYield(true) in last handler does not trigger 404 response
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 9.2k
- Forks
- 625
- Avg merge
- 6h 7m
- Merged PRs (30d)
- 13
Description
version: v20.51.0
platform: Microsoft Windows NT 10.0.19045.0 x64
calling setYield breaks default handler
i can assume it is a bug or undocumented behavior
in both cases fix is required
example:
import { App } from "uWebSockets.js";
const app = App();
app.listen(8080, function(token) {
if (!token) console.error(`Failed to start listening`)
})
request to example above results in the following response
> GET / HTTP/1.1
> Host: localhost:8080
> Accept: */*
< HTTP/1.1 404 File Not Found
< Date: Mon, 21 Apr 2025 13:28:41 GMT
< uWebSockets: 20
< Content-Length: 81
with body
<html><body><h1>File Not Found</h1><hr><i>uWebSockets/20 Server</i></body></html>
but when any listener that just yields attached
import { App } from "uWebSockets.js";
const app = App();
app.any("/*", function(res, req) {
console.log(req.getMethod(), req.getUrl());
req.setYield(true);
});
app.listen(8080, function(token) {
if (!token) console.error(`Failed to start listening`)
})
same request fails
> GET / HTTP/1.1
> Host: localhost:8080
> Accept: */*
* Empty reply from server
* Closing connection 60
problem can be solved with attachment of explicit default handler
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the two uWebSockets.js App examples on Windows with v20.51.0, comparing the default 404 response with the app.any("/*") handler that calls req.setYield(true). Trace how setYield interacts with the default handler and verify that an unmatched request still receives the expected 404 response rather than an empty reply.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, javascript, nodejs
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100