mirror of
				https://github.com/godotengine/godot.git
				synced 2025-10-31 05:31:01 +00:00 
			
		
		
		
	Fix non chunked HTTP reading till eof.
This commit is contained in:
		
							parent
							
								
									c7fc3dcab3
								
							
						
					
					
						commit
						ab0e610e86
					
				
					 2 changed files with 31 additions and 17 deletions
				
			
		|  | @ -330,15 +330,13 @@ bool HTTPRequest::_update_connection() { | |||
| 					return true; | ||||
| 				} | ||||
| 
 | ||||
| 				if (client->is_response_chunked()) { | ||||
| 					body_len = -1; // No body len because chunked, change your webserver configuration if you want body len
 | ||||
| 				} else { | ||||
| 					body_len = client->get_response_body_length(); | ||||
| 				// No body len (-1) if chunked or no content-length header was provided.
 | ||||
| 				// Change your webserver configuration if you want body len.
 | ||||
| 				body_len = client->get_response_body_length(); | ||||
| 
 | ||||
| 					if (body_size_limit >= 0 && body_len > body_size_limit) { | ||||
| 						call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); | ||||
| 						return true; | ||||
| 					} | ||||
| 				if (body_size_limit >= 0 && body_len > body_size_limit) { | ||||
| 					call_deferred("_request_done", RESULT_BODY_SIZE_LIMIT_EXCEEDED, response_code, response_headers, PoolByteArray()); | ||||
| 					return true; | ||||
| 				} | ||||
| 
 | ||||
| 				if (download_to_file != String()) { | ||||
|  | @ -378,6 +376,9 @@ bool HTTPRequest::_update_connection() { | |||
| 					call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body); | ||||
| 					return true; | ||||
| 				} | ||||
| 			} else if (client->get_status() == HTTPClient::STATUS_DISCONNECTED) { | ||||
| 				// We read till EOF, with no errors. Request is done.
 | ||||
| 				call_deferred("_request_done", RESULT_SUCCESS, response_code, response_headers, body); | ||||
| 			} | ||||
| 
 | ||||
| 			return false; | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Fabio Alessandrelli
						Fabio Alessandrelli