qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-dispatch git commit: DISPATCH-874: allow .json and .woff2 files to be served by console.
Date Mon, 04 Dec 2017 20:46:07 GMT
Repository: qpid-dispatch
Updated Branches:
  refs/heads/master e531e1cff -> 611f8b706


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.


Project: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/commit/611f8b70
Tree: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/tree/611f8b70
Diff: http://git-wip-us.apache.org/repos/asf/qpid-dispatch/diff/611f8b70

Branch: refs/heads/master
Commit: 611f8b70628d65067129a639e8df693ecde8244a
Parents: e531e1c
Author: Alan Conway <aconway@redhat.com>
Authored: Mon Dec 4 15:40:19 2017 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Mon Dec 4 15:40:19 2017 -0500

----------------------------------------------------------------------
 src/http-libwebsockets.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-dispatch/blob/611f8b70/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


Mime
View raw message