mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:12:43 +00:00 
			
		
		
		
	LibHTTP+WebDriver+WebServer: Return error from HTTP request parser
This commit is contained in:
		
							parent
							
								
									5b31d1208f
								
							
						
					
					
						commit
						9220cdc285
					
				
					 6 changed files with 35 additions and 13 deletions
				
			
		|  | @ -182,6 +182,9 @@ Client::Client(NonnullOwnPtr<Core::BufferedTCPSocket> socket, Core::Object* pare | |||
|                 [](AK::Error const& error) { | ||||
|                     warnln("Internal error: {}", error); | ||||
|                 }, | ||||
|                 [](HTTP::HttpRequest::ParseError const& error) { | ||||
|                     warnln("HTTP request parsing error: {}", HTTP::HttpRequest::parse_error_to_string(error)); | ||||
|                 }, | ||||
|                 [this](WebDriver::Error const& error) { | ||||
|                     if (send_error_response(error).is_error()) | ||||
|                         warnln("Could not send error response"); | ||||
|  | @ -221,9 +224,7 @@ ErrorOr<void, Client::WrappedError> Client::on_ready_to_read() | |||
|             break; | ||||
|     } | ||||
| 
 | ||||
|     m_request = HTTP::HttpRequest::from_raw_request(TRY(builder.to_byte_buffer())); | ||||
|     if (!m_request.has_value()) | ||||
|         return {}; | ||||
|     m_request = TRY(HTTP::HttpRequest::from_raw_request(TRY(builder.to_byte_buffer()))); | ||||
| 
 | ||||
|     auto body = TRY(read_body_as_json()); | ||||
|     TRY(handle_request(move(body))); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Aliaksandr Kalenik
						Aliaksandr Kalenik