diff --git a/dap-sdk/net/client/dap_client_http.c b/dap-sdk/net/client/dap_client_http.c index 21b64ff7ae86fcf1deed864c69826860a677eb82..5479755319da3f0bdca573bc85044a24eaff0be5 100644 --- a/dap-sdk/net/client/dap_client_http.c +++ b/dap-sdk/net/client/dap_client_http.c @@ -44,6 +44,7 @@ typedef struct dap_http_client_internal { dap_client_http_callback_data_t response_callback; dap_client_http_callback_error_t error_callback; + dap_client_http_callback_error_ext_t error_ext_callback; void *obj; // dap_client_pvt_t *client_pvt; byte_t *request; @@ -535,7 +536,8 @@ static void s_http_connected(dap_events_socket_t * a_esocket) ? dap_snprintf(l_request_headers + l_offset, l_offset2 -= l_offset, "Cookie: %s\r\n", l_http_pvt->cookie) : 0; - l_offset = l_http_pvt->request ? dap_snprintf(l_get_str, sizeof(l_get_str), "?%s", l_http_pvt->request) : 0; + if ((l_http_pvt->request_size && l_http_pvt->request_size)) + dap_snprintf(l_get_str, sizeof(l_get_str), "?%s", l_http_pvt->request) ; } // send header @@ -543,9 +545,9 @@ static void s_http_connected(dap_events_socket_t * a_esocket) "Host: %s\r\n" "%s" "\r\n", - l_http_pvt->method, l_http_pvt->path, strlen(l_get_str) ? l_get_str : "", l_http_pvt->uplink_addr, l_request_headers); + l_http_pvt->method, l_http_pvt->path, l_get_str, l_http_pvt->uplink_addr, l_request_headers); // send data for POST request - if (l_http_pvt->request_size) { + if (l_http_pvt->request_size && l_http_pvt->request_size) { dap_events_socket_write_unsafe( a_esocket, l_http_pvt->request, l_http_pvt->request_size); } } diff --git a/dap-sdk/net/client/include/dap_client_http.h b/dap-sdk/net/client/include/dap_client_http.h index 8b459ff5e725fb7aa6fe9c7ea7cf492b861b6049..36a26df4589a53b44d6a4d148b3e3cf20ae606d4 100644 --- a/dap-sdk/net/client/include/dap_client_http.h +++ b/dap-sdk/net/client/include/dap_client_http.h @@ -29,6 +29,7 @@ extern "C" { #endif typedef void (*dap_client_http_callback_error_t)(int, void *); // Callback for specific http client operations +typedef void (*dap_client_http_callback_error_ext_t)(int,int , void *,size_t, void *); // Callback with extended error processing typedef void (*dap_client_http_callback_data_t)(void *, size_t, void *); // Callback for specific http client operations void* dap_client_http_request_custom(dap_worker_t * a_worker, const char *a_uplink_addr, uint16_t a_uplink_port, const char *a_method,