From f57eb8742f69fa49e487379affe93ba14cef3dc3 Mon Sep 17 00:00:00 2001 From: runge Date: Tue, 20 Mar 2007 23:26:33 +0000 Subject: [PATCH] Add "Connection: close" to HTTP replies. --- ChangeLog | 3 +++ libvncserver/httpd.c | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b2f7a1d..7cdf02e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,6 @@ +2007-03-20 Karl Runge + * libvncserver/httpd.c: Add "Connection: close" to HTTP replies. + 2007-03-17 Charles Coffing * libvncserver: fix a locking issue diff --git a/libvncserver/httpd.c b/libvncserver/httpd.c index a78cf73..c183543 100755 --- a/libvncserver/httpd.c +++ b/libvncserver/httpd.c @@ -59,6 +59,9 @@ #include #endif +#define connection_close +#ifndef connection_close + #define NOT_FOUND_STR "HTTP/1.0 404 Not found\r\n\r\n" \ "File Not Found\n" \ "

File Not Found

\n" @@ -67,10 +70,20 @@ "Invalid Request\n" \ "

Invalid request

\n" -#if 1 #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" \ + "File Not Found\n" \ + "

File Not Found

\n" + +#define INVALID_REQUEST_STR "HTTP/1.0 400 Invalid Request\r\nConnection: close\r\n\r\n" \ + "Invalid Request\n" \ + "

Invalid request

\n" + #define OK_STR "HTTP/1.0 200 OK\r\nConnection: close\r\nContent-Type: text/html\r\n\r\n" + #endif static void httpProcessInput(rfbScreenInfoPtr screen); @@ -332,7 +345,7 @@ httpProcessInput(rfbScreenInfoPtr rfbScreen) return; } - if (sscanf(buf, "GET %s HTTP/1.0", fname) != 1) { + if (sscanf(buf, "GET %s HTTP/1.", fname) != 1) { rfbErr("httpd: couldn't parse GET line\n"); httpCloseSock(rfbScreen); return;