mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
Make mg_url_port() return 80 for ws://
This commit is contained in:
1 parent
30d86928d5
commit
d83e547fa9
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -3634,7 +3634,7 @@ const char *mg_url_uri(const char *url) {
|
|||||||
unsigned short mg_url_port(const char *url) {
|
unsigned short mg_url_port(const char *url) {
|
||||||
struct url u = urlparse(url);
|
struct url u = urlparse(url);
|
||||||
unsigned short port = 0;
|
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, "wss:", 4) == 0 || memcmp(url, "https:", 6) == 0) port = 443;
|
||||||
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
||||||
if (memcmp(url, "mqtts:", 6) == 0) port = 8883;
|
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) {
|
unsigned short mg_url_port(const char *url) {
|
||||||
struct url u = urlparse(url);
|
struct url u = urlparse(url);
|
||||||
unsigned short port = 0;
|
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, "wss:", 4) == 0 || memcmp(url, "https:", 6) == 0) port = 443;
|
||||||
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
if (memcmp(url, "mqtt:", 5) == 0) port = 1883;
|
||||||
if (memcmp(url, "mqtts:", 6) == 0) port = 8883;
|
if (memcmp(url, "mqtts:", 6) == 0) port = 8883;
|
||||||
|
|||||||
Reference in new issue
Block a user