You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by gm...@apache.org on 2018/02/16 18:21:34 UTC
qpid-dispatch git commit: DISPATCH-874: allow .json and .woff2 files
to be served by console.
Repository: qpid-dispatch
Updated Branches:
refs/heads/1.0.x 5dc72526b -> 104108f27
DISPATCH-874: allow .json and .woff2 files to be served by console.
Added .json and .woff2 mime-types to the recognized list.
Added a default rule to serve unrecognized files as "application/octet-stream"
New file types required by the console should be added explicitly as browsers
may restrict what can be done with application/octet-stream files.
(cherry picked from commit 611f8b70628d65067129a639e8df693ecde8244a)
Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/104108f2
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/104108f2
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/104108f2
Branch: refs/heads/1.0.x
Commit: 104108f27f18b16e3beb7b142229f4fc92204cda
Parents: 5dc7252
Author: Alan Conway <ac...@redhat.com>
Authored: Mon Dec 4 15:40:19 2017 -0500
Committer: Ganesh Murthy <gm...@redhat.com>
Committed: Fri Feb 16 13:16:21 2018 -0500
----------------------------------------------------------------------
src/http-libwebsockets.c | 10 ++++++++++
1 file changed, 10 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/104108f2/src/http-libwebsockets.c
----------------------------------------------------------------------
diff --git a/src/http-libwebsockets.c b/src/http-libwebsockets.c
index 990d694..ec6c47e 100644
--- a/src/http-libwebsockets.c
+++ b/src/http-libwebsockets.c
@@ -255,6 +255,15 @@ static qd_http_listener_t *qd_http_listener(qd_http_server_t *hs, qd_listener_t
return hl;
}
+/* Linked list: first entry on each line should point to next, last line should be the
+ * octet-stream default.
+ */
+static const struct lws_protocol_vhost_options mime_types[] = {
+ { &mime_types[1], NULL, ".json", "application/json" },
+ { &mime_types[2], NULL, ".woff2", "font/woff2" },
+ { NULL, NULL, "*", "application/octet-stream" }
+};
+
static void listener_start(qd_http_listener_t *hl, qd_http_server_t *hs) {
log_init(); /* Update log flags at each listener */
@@ -273,6 +282,7 @@ static void listener_start(qd_http_listener_t *hl, qd_http_server_t *hs) {
config->http_root : QPID_CONSOLE_STAND_ALONE_INSTALL_DIR;
m->def = "index.html"; /* Default file name */
m->origin_protocol = LWSMPRO_FILE; /* mount type is a directory in a filesystem */
+ m->extra_mimetypes = mime_types;
struct lws_context_creation_info info = {0};
info.mounts = m;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org