Comments (5)
Thanks, it's pushed on main
from libwebsockets.
I guess so if you need to stop it producing the listen socket itself but then adopt one that is listening on some port... it probably only needs to take care about CONTEXT_PORT_NO_LISTEN_SERVER
case though?
from libwebsockets.
Thanks for the quick answer.
To understand better: why does it not happen with HTTP/2?
Should I make a PR?
from libwebsockets.
It looks like it checks at upgrade time for h1 if LWS_SERVER_OPTION_VHOST_UPG_STRICT_HOST_CHECK
set. But for h2, it normally negotiates what protocol you want at tls negotiation time, using alpn, and there is no h1->h2c upgrade used. There is an h2c upgrade mechanism supported, but eg browsers do it at tls time instead by alpn.
Once h2 is connected, streams inside the connection inherit the outside port.
If you checked it works for your adoption case, yes open a PR or just let me know your From: string and paste the change and I'll do it.
from libwebsockets.
Ah, I understand. Here's the patch:
From 18e26a7a6dce0617e7d14d98655efd0e59b7170d Mon Sep 17 00:00:00 2001
From: markmaker <mark@makr.zone>
Date: Mon, 8 Jan 2024 14:53:30 +0100
Subject: [PATCH] Ignore a vhost port mismatch when using
CONTEXT_PORT_NO_LISTEN_SERVER.
---
lib/roles/http/server/server.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lib/roles/http/server/server.c b/lib/roles/http/server/server.c
index 9bf1eba2..ff5b1255 100644
--- a/lib/roles/http/server/server.c
+++ b/lib/roles/http/server/server.c
@@ -2153,7 +2153,8 @@ lws_confirm_host_header(struct lws *wsi)
if (e != LWS_TOKZE_ENDED)
goto bad_format;
- if (wsi->a.vhost->listen_port != port) {
+ if (wsi->a.vhost->listen_port != port &&
+ wsi->a.vhost->listen_port != CONTEXT_PORT_NO_LISTEN_SERVER) {
lwsl_info("%s: host port %d mismatches vhost port %d\n",
__func__, port, wsi->a.vhost->listen_port);
return 1;
--
2.40.1
from libwebsockets.
Related Issues (20)
- Client digest auth HOT 2
- Missing string termination in lws_hdr_custom_name_foreach HOT 8
- Bug in HTTP2 form POST file upload HOT 2
- HTTP2 ah count keeps going up when using custom event lib HOT 4
- WolfSSL not compatible with LWS due to missing SSL_CTX_use_certificate_ASN1
- feature request: reserved bits extension or callback? HOT 6
- feature request: make ws extensions default on
- Unused variable date compile error when building with LWS_WITH_NO_LOGS HOT 1
- feature request: extension allow use rsv and opcode HOT 2
- What does return value of lws_service mean? HOT 3
- duplicate `LWS_CALLBACK_RAW_CONNECTED` event in raw-client HOT 1
- `lws_get_library_version` return `4.3.3-unknown` HOT 1
- AES function is misdocumented as RSA function HOT 3
- compression HOT 7
- feature request: support SSLKEYLOGFILE for openssl HOT 2
- delayed in LWS_CALLBACK_CLIENT_CLOSED from libwebsocket HOT 4
- How to change the timeout of http/1.1 keepalive? HOT 2
- Bus error core dumped HOT 2
- feature request: load event lib from related "../lib" for CLion HOT 1
- Add support for HTTP Basic Authentication password which may contain random bytes including null-chars. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libwebsockets.