mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:12:45 +00:00 
			
		
		
		
	 30cdebfa9e
			
		
	
	
		30cdebfa9e
		
	
	
	
	
		
			
			This changes the RequestClient::start_request() method to take a URL object instead of a URL string as argument. All callers of the method already had a URL object anyway, and start_request() in turn parses the URL string back into a URL object. This removes this unnecessary conversion.
		
			
				
	
	
		
			41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			41 lines
		
	
	
	
		
			1.2 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /*
 | |
|  * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
 | |
|  *
 | |
|  * SPDX-License-Identifier: BSD-2-Clause
 | |
|  */
 | |
| 
 | |
| #pragma once
 | |
| 
 | |
| #include <AK/HashMap.h>
 | |
| #include <LibIPC/ServerConnection.h>
 | |
| #include <RequestServer/RequestClientEndpoint.h>
 | |
| #include <RequestServer/RequestServerEndpoint.h>
 | |
| 
 | |
| namespace Protocol {
 | |
| 
 | |
| class Request;
 | |
| 
 | |
| class RequestClient final
 | |
|     : public IPC::ServerConnection<RequestClientEndpoint, RequestServerEndpoint>
 | |
|     , public RequestClientEndpoint {
 | |
|     C_OBJECT(RequestClient);
 | |
| 
 | |
| public:
 | |
|     template<typename RequestHashMapTraits = Traits<String>>
 | |
|     RefPtr<Request> start_request(String const& method, URL const&, HashMap<String, String, RequestHashMapTraits> const& request_headers = {}, ReadonlyBytes request_body = {});
 | |
| 
 | |
|     bool stop_request(Badge<Request>, Request&);
 | |
|     bool set_certificate(Badge<Request>, Request&, String, String);
 | |
| 
 | |
| private:
 | |
|     RequestClient();
 | |
| 
 | |
|     virtual void request_progress(i32, Optional<u32> const&, u32) override;
 | |
|     virtual void request_finished(i32, bool, u32) override;
 | |
|     virtual void certificate_requested(i32) override;
 | |
|     virtual void headers_became_available(i32, IPC::Dictionary const&, Optional<u32> const&) override;
 | |
| 
 | |
|     HashMap<i32, RefPtr<Request>> m_requests;
 | |
| };
 | |
| 
 | |
| }
 |