summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Beier <dontmind@freeshell.org>2011-10-06 14:29:06 +0200
committerChristian Beier <dontmind@freeshell.org>2011-10-06 14:29:06 +0200
commit5756b133f737642e2bb3c9a319b101c0ac23723e (patch)
tree109677640f842567fd1a8dd18ca5cad4eca05b36
parent03d9b519176d6f25ce13e4b86298ae762f32cd4b (diff)
downloadlibvncserver-5756b133f737642e2bb3c9a319b101c0ac23723e.zip
libvncserver-5756b133f737642e2bb3c9a319b101c0ac23723e.tar.gz
httpd: fix sending of binary data such as images.
We do this simply by omitting the content-type and let the browser decide upon the mime-type of the sent file. Only exception is 'index.vnc', where we do set the content-type since some browsers fail to detect it's html when it's ending in '.vnc' Also, remove superfluous #defines. We close the connection always.
-rw-r--r--libvncserver/httpd.c24
1 files changed, 7 insertions, 17 deletions
diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c
index 83fc520..3252fc6 100644
--- a/libvncserver/httpd.c
+++ b/libvncserver/httpd.c
@@ -59,20 +59,6 @@
#include <tcpd.h>
#endif
-#define connection_close
-#ifndef connection_close
-
-#define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\n\r\n" \
- "<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
- "<BODY><H1>File Not Found</H1></BODY>\n"
-
-#define INVALID_REQUEST_STR "HTTP/1.0 400 Invalid Request\r\n\r\n" \
- "<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \
- "<BODY><H1>Invalid request</H1></BODY>\n"
-
-#define OK_STR "HTTP/1.0 200 OK\r\nContent-Type: text/html\r\n\r\n"
-
-#else
#define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\nConnection: close\r\n\r\n" \
"<HEAD><TITLE>File Not Found</TITLE></HEAD>\n" \
@@ -82,9 +68,10 @@
"<HEAD><TITLE>Invalid Request</TITLE></HEAD>\n" \
"<BODY><H1>Invalid request</H1></BODY>\n"
-#define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n"
+#define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n"
+#define OK_STR_HTML "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n"
+
-#endif
static void httpProcessInput(rfbScreenInfoPtr screen);
static rfbBool compareAndSkip(char **ptr, const char *str);
@@ -386,7 +373,10 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen)
return;
}
- rfbWriteExact(&cl, OK_STR, strlen(OK_STR));
+ if(performSubstitutions) /* is the 'index.vnc' file */
+ rfbWriteExact(&cl, OK_STR_HTML, strlen(OK_STR_HTML));
+ else
+ rfbWriteExact(&cl, OK_STR, strlen(OK_STR));
while (1) {
int n = fread(buf, 1, BUF_SIZE-1, fd);
OpenPOWER on IntegriCloud