mirror of
				https://github.com/espressif/esp-idf.git
				synced 2025-11-04 06:11:06 +00:00 
			
		
		
		
	Merge branch 'fix/trigger_finish_event_if_data_retreived_successfully' into 'master'
fix(esp_http_client): fix dispatching of finish event condition Closes IDFGH-16285 See merge request espressif/esp-idf!41624
This commit is contained in:
		@@ -1538,11 +1538,11 @@ esp_err_t esp_http_client_perform(esp_http_client_handle_t client)
 | 
				
			|||||||
                if (err != ESP_OK) {
 | 
					                if (err != ESP_OK) {
 | 
				
			||||||
                    http_dispatch_event(client, HTTP_EVENT_ERROR, esp_transport_get_error_handle(client->transport), 0);
 | 
					                    http_dispatch_event(client, HTTP_EVENT_ERROR, esp_transport_get_error_handle(client->transport), 0);
 | 
				
			||||||
                    http_dispatch_event_to_event_loop(HTTP_EVENT_ERROR, &client, sizeof(esp_http_client_handle_t));
 | 
					                    http_dispatch_event_to_event_loop(HTTP_EVENT_ERROR, &client, sizeof(esp_http_client_handle_t));
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    http_dispatch_event(client, HTTP_EVENT_ON_FINISH, NULL, 0);
 | 
				
			||||||
 | 
					                    http_dispatch_event_to_event_loop(HTTP_EVENT_ON_FINISH, &client, sizeof(esp_http_client_handle_t));
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                http_dispatch_event(client, HTTP_EVENT_ON_FINISH, NULL, 0);
 | 
					 | 
				
			||||||
                http_dispatch_event_to_event_loop(HTTP_EVENT_ON_FINISH, &client, sizeof(esp_http_client_handle_t));
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
                client->response->buffer->raw_len = 0;
 | 
					                client->response->buffer->raw_len = 0;
 | 
				
			||||||
                if (!http_should_keep_alive(client->parser)) {
 | 
					                if (!http_should_keep_alive(client->parser)) {
 | 
				
			||||||
                    ESP_LOGD(TAG, "Close connection");
 | 
					                    ESP_LOGD(TAG, "Close connection");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -42,7 +42,7 @@ typedef enum {
 | 
				
			|||||||
    HTTP_EVENT_ON_HEADERS_COMPLETE, /*!< Occurs when all headers are received on the client side */
 | 
					    HTTP_EVENT_ON_HEADERS_COMPLETE, /*!< Occurs when all headers are received on the client side */
 | 
				
			||||||
    HTTP_EVENT_ON_STATUS_CODE,  /*!< Occurs when receiving the HTTP status code from the server */
 | 
					    HTTP_EVENT_ON_STATUS_CODE,  /*!< Occurs when receiving the HTTP status code from the server */
 | 
				
			||||||
    HTTP_EVENT_ON_DATA,         /*!< Occurs when receiving data from the server, possibly multiple portions of the packet */
 | 
					    HTTP_EVENT_ON_DATA,         /*!< Occurs when receiving data from the server, possibly multiple portions of the packet */
 | 
				
			||||||
    HTTP_EVENT_ON_FINISH,       /*!< Occurs when finish a HTTP session */
 | 
					    HTTP_EVENT_ON_FINISH,       /*!< Occurs when complete data is received */
 | 
				
			||||||
    HTTP_EVENT_DISCONNECTED,    /*!< The connection has been disconnected */
 | 
					    HTTP_EVENT_DISCONNECTED,    /*!< The connection has been disconnected */
 | 
				
			||||||
    HTTP_EVENT_REDIRECT,        /*!< Intercepting HTTP redirects to handle them manually */
 | 
					    HTTP_EVENT_REDIRECT,        /*!< Intercepting HTTP redirects to handle them manually */
 | 
				
			||||||
} esp_http_client_event_id_t;
 | 
					} esp_http_client_event_id_t;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user