Skip to content

httpserver: missing query string in request info#859

Merged
saghul merged 2 commits intosaghul:masterfrom
KawaiiZapic:patch/http-server-query-string
Mar 15, 2026
Merged

httpserver: missing query string in request info#859
saghul merged 2 commits intosaghul:masterfrom
KawaiiZapic:patch/http-server-query-string

Conversation

@KawaiiZapic
Copy link
Copy Markdown
Contributor

lws_http_get_uri_and_method does not include the query string of request, we need use lws_hdr_copy(wsi, bufsize, WSI_TOKEN_HTTP_URI_ARGS) to get the query string.

@saghul
Copy link
Copy Markdown
Owner

saghul commented Mar 15, 2026

Nice one, thank you! Did you check if hash parameters are copied correctly?

@KawaiiZapic
Copy link
Copy Markdown
Contributor Author

Nice one, thank you! Did you check if hash parameters are copied correctly?

The hash part don't sent to server, we don't need to handle it.

@KawaiiZapic
Copy link
Copy Markdown
Contributor Author

And I think an error should be thrown when the pathname or query or something is too long, the current behavior is just ignoring the over-limit part, in some edge cases, this may cause some confusion.

@saghul
Copy link
Copy Markdown
Owner

saghul commented Mar 15, 2026

We could compute the necessary length and always dynamically allocate it?

@KawaiiZapic
Copy link
Copy Markdown
Contributor Author

KawaiiZapic commented Mar 15, 2026

We could compute the necessary length and always dynamically allocate it?

That will cause some security problems, attacker can send a large payload to comsume all memory on server.
IMHO we would better have a configuable limit of header size and body size.

Usually, 2048 bytes header should enough for most case, the problem is url being truncated without any notice.

@saghul
Copy link
Copy Markdown
Owner

saghul commented Mar 15, 2026

Fair enough. That's what we have right now though, which I guess it's reasonable.

Let's fix it if / when we run into real world problems?

@KawaiiZapic
Copy link
Copy Markdown
Contributor Author

Fair enough. That's what we have right now though, which I guess it's reasonable.

Let's fix it if / when we run into real world problems?

That's ok.

@saghul saghul merged commit f046df2 into saghul:master Mar 15, 2026
57 of 62 checks passed
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

Successfully merging this pull request may close these issues.

2 participants