From ac5c2f40a2e25e12e2cd918e88f2101c5bb2f1fa Mon Sep 17 00:00:00 2001
From: Přemysl Janouch
Date: Thu, 25 Jun 2015 22:31:51 +0200
Subject: WS: allow leaving out the URL path
It defaults to / now, it used to cause undefined behaviour.
---
json-rpc-shell.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/json-rpc-shell.c b/json-rpc-shell.c
index c5142f6..f15d5db 100644
--- a/json-rpc-shell.c
+++ b/json-rpc-shell.c
@@ -1307,9 +1307,12 @@ backend_ws_connect (struct app_context *ctx, struct error **e)
struct str url_path;
str_init (&url_path);
- str_append_data (&url_path, self->endpoint +
- self->url.field_data[UF_PATH].off,
- self->url.field_data[UF_PATH].len);
+ if (self->url.field_set & (1 << UF_PATH))
+ str_append_data (&url_path, self->endpoint +
+ 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))
{
str_append_c (&url_path, '?');
--
cgit v1.2.3-70-g09d2