Allow adding custom headers to requests to host paths on GUPnPContext
@andrunko
Submitted by Andre Magalhaes Assigned to GUPnP Maintainers
Link to original bug (#730945)
Description
Created attachment 277469 Patch
While implementing a DIAL (http://dial-multiscreen.org/) service using gupnp I stumbled upon an issue where the DIAL protocol would require adding a custom header to requests to the device location, but gupnp wouldn't allow it.
The attached patch adds a method to allow setting a custom callback for host path requests, which can then be used to add custom headers to responses.
Relevant code: static void _get_device_description_cb (GUPnPContext *context, SoupMessage *msg, const gchar *server_path, gpointer user_data) { SdkDialServiceDevice *self = (SdkDialServiceDevice *) user_data;
soup_message_headers_append (msg->response_headers, "Application-URL", self->app_url); }
{ ...
self->location = (SoupURI *) gupnp_device_info_get_url_base (GUPNP_DEVICE_INFO (self->dev));
/* Setup custom callback to be invoked on requests to the device description
- location url, required to add the DIAL specific Application-URL header to
- the response */ gupnp_context_host_path_set_callback (self->context, soup_uri_get_path ((SoupURI *) self->location), _get_device_description_cb, self); ... }
Patch 277469, "Patch":
0001-Add-method-to-allow-setting-a-custom-callback-to-act.patch