uNetworking / uNetworking/uWebSockets

HttpRequest::getMethod modifies request

Open
#1,826 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C++
Stars
19k
Forks
1.9k
Avg merge
3h 24m
Merged PRs (30d)
5

Description

I was testing HelloWorld example with io_uring backend and found out that
the server sometimes(quite often actually) calls any("/") route rather than get("/") route even though req->getMethod() returns "get" within that any() route.
test command: ./wrk -t 8 -c 1000 -d 10s http://localhost:3000/foo
I found out that's because req->getMethod() modifies the method to lowercase and next calls to req->getCaseSensitiveMethod() returns lowercase as well. That in turn confuses the router.
I don't know what calls req->getMethod() before route, but it's happening. Changing this req->getMethod() to return cache rather than modifying this->headers fixes that issue.

Also, I couldn't reproduce it with epoll backend.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementations of req->getMethod() and req->getCaseSensitiveMethod(), then reproduce the routing behavior with the provided wrk command using the io_uring backend. Trace whether method lookup changes the stored headers before routing; done means repeated requests consistently select the get route without regressing the epoll backend.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
backend, networking
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.