- yWeb: try to fix empty pages

This commit is contained in:
svenhoefer
2014-08-30 14:05:18 +02:00
parent 5ec1873982
commit 270e915954
2 changed files with 7 additions and 1 deletions

View File

@@ -96,8 +96,10 @@ void CWebserverConnection::HandleConnection() {
if(string_tolower(Request.HeaderList["Connection"]) == "close"
|| (httprotocol != "HTTP/1.1" && string_tolower(Request.HeaderList["Connection"]) != "keep-alive")
|| !Webserver->CheckKeepAliveAllowedByIP(sock->get_client_ip()))
#endif
keep_alive = false;
#else
keep_alive = false;
#endif
// Send a response
Response.SendResponse();

View File

@@ -27,6 +27,7 @@
#include "ysocket.h"
#include "yconnection.h"
#include "yrequest.h"
#include <system/set_threadname.h>
//=============================================================================
// Initialization of static variables
@@ -117,6 +118,7 @@ CWebserver::~CWebserver() {
#define MAX_TIMEOUTS_TO_CLOSE 10
#define MAX_TIMEOUTS_TO_TEST 100
bool CWebserver::run(void) {
set_threadname(__func__);
if (!listenSocket.listen(port, HTTPD_MAX_CONNECTIONS)) {
if (port != 80) {
fprintf(stderr, "[yhttpd] Socket cannot bind and listen on port %d Abort.\n", port);
@@ -226,6 +228,8 @@ bool CWebserver::run(void) {
CySocket *newConnectionSock;
if (!(newConnectionSock = listenSocket.accept())) //Now: Blocking wait
{
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
pthread_testcancel();
dperror("Socket accept error. Continue.\n");
continue;
}