WS: allow leaving out the URL path

It defaults to / now, it used to cause undefined behaviour.
This commit is contained in:
Přemysl Eric Janouch 2015-06-25 22:31:51 +02:00
parent be1e424e17
commit ac5c2f40a2
1 changed files with 6 additions and 3 deletions

View File

@ -1307,9 +1307,12 @@ backend_ws_connect (struct app_context *ctx, struct error **e)
struct str url_path; struct str url_path;
str_init (&url_path); str_init (&url_path);
str_append_data (&url_path, self->endpoint + if (self->url.field_set & (1 << UF_PATH))
self->url.field_data[UF_PATH].off, str_append_data (&url_path, self->endpoint +
self->url.field_data[UF_PATH].len); self->url.field_data[UF_PATH].off,
self->url.field_data[UF_PATH].len);
else
str_append_c (&url_path, '/');
if (self->url.field_set & (1 << UF_QUERY)) if (self->url.field_set & (1 << UF_QUERY))
{ {
str_append_c (&url_path, '?'); str_append_c (&url_path, '?');