@@ -369,6 +369,10 @@ static void uh_ubus_handle_get_subscribe(struct client *cl, const char *path)
sid = uh_ubus_get_auth(cl->hdr.head);
+ if(!strcmp(sid, UH_UBUS_DEFAULT_SID) && du->sid != NULL) {
+ sid = du->sid;
+ }
+
if (!conf.ubus_noauth && !uh_ubus_allowed(sid, path, ":subscribe")) {
uh_ubus_send_header(cl, 200, "OK", "application/json");
uh_ubus_posix_error(cl, EACCES);
@@ -940,8 +944,10 @@ static void uh_ubus_handle_request(struct client *cl, char *url, struct path_inf
return;
}
chr = strchr(du->url_path, '?');
- if (chr)
+ if (chr) {
+ du->sid = chr + 1;
chr[0] = '\0';
+ }
du->legacy = false;
@@ -211,6 +211,7 @@ struct dispatch_ubus {
struct json_object *jsobj;
struct json_object *jsobj_cur;
char *url_path;
+ char *sid;
int post_len;
uint32_t obj;
In order to use EventSource web content's interface to server-sent events when ubus authentication is enabled, a session id has to be passed. Evensource interface does not allow to use bearer authentication header field. One of the possible solutions is to pass sid in url. Signed-off-by: Wojciech Jowsa <wojciech.jowsa@gmail.com> --- ubus.c | 8 +++++++- uhttpd.h | 1 + 2 files changed, 8 insertions(+), 1 deletion(-)