mirror of
https://github.com/cesanta/mongoose.git
synced 2025-01-15 02:08:08 +08:00
Make mg_url_port() return 80 for ws://
This commit is contained in:
parent
30d86928d5
commit
d83e547fa9
@ -3634,7 +3634,7 @@ const char *mg_url_uri(const char *url) {
|
||||
unsigned short mg_url_port(const char *url) {
|
||||
struct url u = urlparse(url);
|
||||
unsigned short port = 0;
|
||||
if (memcmp(url, "http:", 5) == 0) port = 80;
|
||||
if (memcmp(url, "http:", 5) == 0 || memcmp(url, "ws:", 3) == 0) port = 80;
|
||||
if (memcmp(url, "wss:", 4) == 0 || memcmp(url, "https:", 6) == 0) port = 443;
|
||||
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
||||
if (memcmp(url, "mqtts:", 6) == 0) port = 8883;
|
||||
|
@ -59,7 +59,7 @@ const char *mg_url_uri(const char *url) {
|
||||
unsigned short mg_url_port(const char *url) {
|
||||
struct url u = urlparse(url);
|
||||
unsigned short port = 0;
|
||||
if (memcmp(url, "http:", 5) == 0) port = 80;
|
||||
if (memcmp(url, "http:", 5) == 0 || memcmp(url, "ws:", 3) == 0) port = 80;
|
||||
if (memcmp(url, "wss:", 4) == 0 || memcmp(url, "https:", 6) == 0) port = 443;
|
||||
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
||||
if (memcmp(url, "mqtts:", 6) == 0) port = 8883;
|
||||
|
Loading…
x
Reference in New Issue
Block a user