From b1af5dd20737a5f473132a1fc22cbdedce10dc98 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=D0=B5x=D0=B0nder=20Lysik=D0=BEv?=
 <alexander.lysikov@demlabs.net>
Date: Tue, 17 Dec 2019 23:52:20 +0500
Subject: [PATCH] fixed write_http_client_state

---
 http_server/dap_http_simple.c             | 10 +++++-----
 http_server/http_client/dap_http_client.c |  2 +-
 http_server/http_client/dap_http_client.h |  1 +
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/http_server/dap_http_simple.c b/http_server/dap_http_simple.c
index 50b9f27..5229aa3 100755
--- a/http_server/dap_http_simple.c
+++ b/http_server/dap_http_simple.c
@@ -301,14 +301,14 @@ inline static bool _is_supported_user_agents_list_setted()
 
 inline static void _set_only_write_http_client_state(dap_http_client_t* http_client)
 {
-//  log_it(L_DEBUG,"_set_only_write_http_client_state");
+  log_it(L_DEBUG,"_set_only_write_http_client_state");
 //  Sleep(300);
-
   dap_client_remote_ready_to_read(http_client->client,false);
-  http_client->state_write=DAP_HTTP_CLIENT_STATE_NONE;
+  //http_client->state_write=DAP_HTTP_CLIENT_STATE_NONE;
 
-  dap_client_remote_ready_to_write(http_client->client,true);
   http_client->state_write=DAP_HTTP_CLIENT_STATE_START;
+  dap_client_remote_ready_to_write(http_client->client,true);
+  //http_client->state_write=DAP_HTTP_CLIENT_STATE_START;
 }
 
 static void _copy_reply_and_mime_to_response( dap_http_simple_t *cl_sh )
@@ -381,7 +381,7 @@ void* dap_http_simple_proc( dap_http_simple_t *cl_sh )
     DAP_HTTP_SIMPLE_URL_PROC(cl_sh->http->proc)->proc_callback(cl_sh,&return_code);
 
     if(return_code) {
-        log_it(L_DEBUG, "Request was processed well");
+        log_it(L_DEBUG, "Request was processed well return_code=%d", return_code);
         cl_sh->http->reply_status_code = (uint16_t)return_code;
         _copy_reply_and_mime_to_response(cl_sh);
     } else {
diff --git a/http_server/http_client/dap_http_client.c b/http_server/http_client/dap_http_client.c
index 4ecdcd5..e22f161 100755
--- a/http_server/http_client/dap_http_client.c
+++ b/http_server/http_client/dap_http_client.c
@@ -537,7 +537,7 @@ void dap_http_client_write( dap_client_remote_t * cl, void *arg )
   (void) arg;
   dap_http_client_t *cl_ht = DAP_HTTP_CLIENT( cl );
 
- //   log_it(L_WARNING,"HTTP client write callback in state %d",cl_ht->state_write);
+    log_it(L_WARNING,"HTTP client write callback in state %d",cl_ht->state_write);
 
   switch( cl_ht->state_write ) {
     case DAP_HTTP_CLIENT_STATE_NONE:
diff --git a/http_server/http_client/dap_http_client.h b/http_server/http_client/dap_http_client.h
index f90569b..4c70226 100755
--- a/http_server/http_client/dap_http_client.h
+++ b/http_server/http_client/dap_http_client.h
@@ -53,6 +53,7 @@ typedef struct dap_http_client
     dap_http_client_state_t state_read;
     dap_http_client_state_t state_write;
 
+
     struct dap_http_header *in_headers;
     size_t in_content_length;
     char in_content_type[256];
-- 
GitLab