Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
c357c378
Commit
c357c378
authored
Jan 18, 2020
by
Matthias Loy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: websocket url without path
websocket urls without a path caused crash!
parent
7ea72e56
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
8 deletions
+17
-8
ws_address.cpp
src/ws_address.cpp
+9
-6
ws_listener.cpp
src/ws_listener.cpp
+8
-2
No files found.
src/ws_address.cpp
View file @
c357c378
...
...
@@ -99,14 +99,17 @@ int zmq::ws_address_t::resolve (const char *name_, bool local_, bool ipv6_)
}
_host
=
std
::
string
(
name_
,
delim
-
name_
);
//
find the path part, which is optional
// find the path part, which is optional
delim
=
strrchr
(
name_
,
'/'
);
if
(
delim
)
std
::
string
host_name
;
if
(
delim
)
{
_path
=
std
::
string
(
delim
);
else
// remove the path, otherwise resolving the port will fail with wildcard
host_name
=
std
::
string
(
name_
,
delim
-
name_
);
}
else
{
_path
=
std
::
string
(
"/"
);
// remove the path, otherwise resolving the port will fail with wildcard
std
::
string
host_port
=
std
::
string
(
name_
,
delim
-
name_
);
host_name
=
name_
;
}
ip_resolver_options_t
resolver_opts
;
resolver_opts
.
bindable
(
local_
)
...
...
@@ -118,7 +121,7 @@ int zmq::ws_address_t::resolve (const char *name_, bool local_, bool ipv6_)
ip_resolver_t
resolver
(
resolver_opts
);
return
resolver
.
resolve
(
&
_address
,
host_
port
.
c_str
());
return
resolver
.
resolve
(
&
_address
,
host_
name
.
c_str
());
}
int
zmq
::
ws_address_t
::
to_string
(
std
::
string
&
addr_
)
const
...
...
src/ws_listener.cpp
View file @
c357c378
...
...
@@ -212,8 +212,14 @@ int zmq::ws_listener_t::set_local_address (const char *addr_)
// remove the path, otherwise resolving the port will fail with wildcard
const
char
*
delim
=
strrchr
(
addr_
,
'/'
);
std
::
string
host_port
=
std
::
string
(
addr_
,
delim
-
addr_
);
if
(
create_socket
(
host_port
.
c_str
())
==
-
1
)
std
::
string
host_address
;
if
(
delim
)
{
host_address
=
std
::
string
(
addr_
,
delim
-
addr_
);
}
else
{
host_address
=
addr_
;
}
if
(
create_socket
(
host_address
.
c_str
())
==
-
1
)
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment