Add support for custom http_contenttype in response
authorHenning Rogge <hrogge@googlemail.com>
Sat, 21 Nov 2009 08:59:37 +0000 (09:59 +0100)
committerHenning Rogge <hrogge@googlemail.com>
Sat, 21 Nov 2009 08:59:37 +0000 (09:59 +0100)
src/olsr_comport.h
src/olsr_comport_http.c

index 8bb0392..8781d6b 100644 (file)
@@ -94,6 +94,7 @@ struct comport_connection {
   int fd;
   enum connection_state state;
   enum http_header_type send_as;
+  const char *http_contenttype;
   struct timer_entry *timeout;
   bool is_http, show_echo;
   struct autobuf in;
index 788b5b4..6e1e73e 100644 (file)
@@ -631,7 +631,10 @@ olsr_com_build_httpheader(struct comport_connection *con) {
   abuf_puts(&buf, "Connection: closed\r\n");
 
   /* MIME type */
-  abuf_appendf(&buf, "Content-type: text/%s\r\n", con->send_as != HTTP_PLAIN ? "html" : "plain");
+  if (con->http_contenttype == NULL) {
+    con->http_contenttype = con->send_as != HTTP_PLAIN ? "text/html" : "text/plain";
+  }
+  abuf_appendf(&buf, "Content-type: text/%s\r\n", con->http_contenttype);
 
   /* Content length */
   if (con->out.len > 0) {