diff --git a/http_server/dap_http_folder.c b/http_server/dap_http_folder.c
index 0cc8d2960c62567d82c011d5bb40e562b444d467..8639a25b4b9066075446b118676ab288ae2aa00f 100755
--- a/http_server/dap_http_folder.c
+++ b/http_server/dap_http_folder.c
@@ -259,7 +259,7 @@ void dap_http_folder_headers_write( dap_http_client_t *cl_ht, void * arg)
     }
     else {
       cl_ht->reply_status_code=Http_Status_NotFound;
-      cl_ht->client->signal_close=true;
+      cl_ht->client->flags |= DAP_SOCK_SIGNAL_CLOSE;
       log_it(L_WARNING,"Can't detect MIME type of %s file: %s",cl_ht_file->local_path,magic_error(up_folder->mime_detector));
     }
   }
@@ -304,7 +304,10 @@ void dap_http_folder_data_write(dap_http_client_t * cl_ht, void * arg)
         //strncat(cl_ht->client->buf_out+cl_ht->client->buf_out_size,"\r\n",sizeof(cl_ht->client->buf_out));
         fclose(cl_ht_file->fd);
         dap_client_remote_ready_to_write(cl_ht->client,false);
-        cl_ht->client->signal_close=!cl_ht->keep_alive;
+
+        if ( !cl_ht->keep_alive )
+            cl_ht->client->flags |= DAP_SOCK_SIGNAL_CLOSE;
+
         cl_ht->state_write=DAP_HTTP_CLIENT_STATE_NONE;
     }
 }
diff --git a/http_server/dap_http_simple.c b/http_server/dap_http_simple.c
index ad656d530ab9db2954464c5cd430bfca92d0c5ea..cc0c2fa5c3712181d26c4dbf3c36b7e226090279 100755
--- a/http_server/dap_http_simple.c
+++ b/http_server/dap_http_simple.c
@@ -495,7 +495,7 @@ void dap_http_simple_data_write( dap_http_client_t *a_http_client, void *a_arg )
 
   if ( !cl_st->reply ) {
 
-    a_http_client->client->signal_close = true;
+    a_http_client->client->flags |= DAP_SOCK_SIGNAL_CLOSE;
     log_it( L_WARNING, "No reply to write, close connection" );
 
     return;
@@ -508,7 +508,7 @@ void dap_http_simple_data_write( dap_http_client_t *a_http_client, void *a_arg )
   if ( cl_st->reply_sent >= a_http_client->out_content_length ) {
     log_it(L_INFO, "All the reply (%u) is sent out", a_http_client->out_content_length );
     //cl_ht->client->signal_close=cl_ht->keep_alive;
-    a_http_client->client->signal_close = true;
+    a_http_client->client->flags |= DAP_SOCK_SIGNAL_CLOSE;
     //dap_client_ready_to_write(cl_ht->client,false);
   }
 
diff --git a/http_server/http_client/dap_http_client.c b/http_server/http_client/dap_http_client.c
index 430a7418c9fb0d9e41a2a50d056a95d6f5a5eba4..99cb6c1b1aeeb80a480bcd275b85a5fcdc0d8644 100755
--- a/http_server/http_client/dap_http_client.c
+++ b/http_server/http_client/dap_http_client.c
@@ -570,7 +570,7 @@ void dap_http_client_write( dap_client_remote_t * cl, void *arg )
           log_it( L_DEBUG, "Nothing to output" );
           cl_ht->state_write = DAP_HTTP_CLIENT_STATE_NONE;
           dap_client_remote_ready_to_write( cl, false );
-          cl->signal_close = true;
+          cl->flags |= DAP_SOCK_SIGNAL_CLOSE;
         }
         dap_client_remote_ready_to_read( cl, true );
       }
diff --git a/http_server/http_client/dap_http_client_simple.c b/http_server/http_client/dap_http_client_simple.c
index b11ae8cd940809c683e90f0e88a142d16d0f96e7..79d43ba19e10bfed320ae4de28d5eab77dfa50cd 100755
--- a/http_server/http_client/dap_http_client_simple.c
+++ b/http_server/http_client/dap_http_client_simple.c
@@ -346,10 +346,10 @@ static void* dap_http_client_thread(void * arg)
         rc = 0;
 
         if(maxfd == -1) {
-            log_it(L_DEBUG, "Waiting for signal");
+//            log_it(L_DEBUG, "Waiting for signal");
             pthread_cond_wait(&m_curl_cond,&m_curl_mutex);
         }  else {
-            log_it(L_DEBUG, "Selecting stuff");
+//            log_it(L_DEBUG, "Selecting stuff");
           /* Note that on some platforms 'timeout' may be modified by select().
              If you need access to the original value save a copy beforehand. */
           rc = select(maxfd + 1, &fdread, &fdwrite, &fdexcep, &timeout);