| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Copyright (c) 2022, Linus Groh <linusg@serenityos.org> | 
					
						
							| 
									
										
										
										
											2024-04-29 20:54:14 +01:00
										 |  |  |  * Copyright (c) 2024, Jamie Mansfield <jmansfield@cadixdev.org> | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  |  * | 
					
						
							|  |  |  |  * SPDX-License-Identifier: BSD-2-Clause | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #pragma once
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #include <AK/Forward.h>
 | 
					
						
							|  |  |  | #include <LibJS/Forward.h>
 | 
					
						
							| 
									
										
										
										
											2023-02-10 08:29:14 -05:00
										 |  |  | #include <LibJS/Heap/GCPtr.h>
 | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | #include <LibWeb/Forward.h>
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | namespace Web::Fetch::Fetching { | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2024-07-12 20:01:10 +01:00
										 |  |  | // https://fetch.spec.whatwg.org/#document-accept-header-value
 | 
					
						
							|  |  |  | // The document `Accept` header value is `text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8`.
 | 
					
						
							|  |  |  | constexpr auto document_accept_header_value = "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"sv; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | #define ENUMERATE_BOOL_PARAMS                     \
 | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(IncludeCredentials)    \ | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(IsAuthenticationFetch) \ | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(IsNewConnectionFetch)  \ | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(MakeCORSPreflight)     \ | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(Recursive)             \ | 
					
						
							|  |  |  |     __ENUMERATE_BOOL_PARAM(UseParallelQueue) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #define __ENUMERATE_BOOL_PARAM(Name) \
 | 
					
						
							|  |  |  |     enum class Name {                \ | 
					
						
							|  |  |  |         Yes,                         \ | 
					
						
							|  |  |  |         No,                          \ | 
					
						
							|  |  |  |     }; | 
					
						
							|  |  |  | ENUMERATE_BOOL_PARAMS | 
					
						
							|  |  |  | #undef __ENUMERATE_BOOL_PARAM
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<Infrastructure::FetchController>> fetch(JS::Realm&, Infrastructure::Request&, Infrastructure::FetchAlgorithms const&, UseParallelQueue use_parallel_queue = UseParallelQueue::No); | 
					
						
							| 
									
										
										
										
											2024-04-07 15:40:20 +02:00
										 |  |  | WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> main_fetch(JS::Realm&, Infrastructure::FetchParams const&, Recursive recursive = Recursive::No); | 
					
						
							| 
									
										
										
										
											2024-04-26 14:57:40 -04:00
										 |  |  | void fetch_response_handover(JS::Realm&, Infrastructure::FetchParams const&, Infrastructure::Response&); | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> scheme_fetch(JS::Realm&, Infrastructure::FetchParams const&); | 
					
						
							|  |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_fetch(JS::Realm&, Infrastructure::FetchParams const&, MakeCORSPreflight make_cors_preflight = MakeCORSPreflight::No); | 
					
						
							| 
									
										
										
										
											2024-04-07 15:40:20 +02:00
										 |  |  | WebIDL::ExceptionOr<JS::GCPtr<PendingResponse>> http_redirect_fetch(JS::Realm&, Infrastructure::FetchParams const&, Infrastructure::Response&); | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> http_network_or_cache_fetch(JS::Realm&, Infrastructure::FetchParams const&, IsAuthenticationFetch is_authentication_fetch = IsAuthenticationFetch::No, IsNewConnectionFetch is_new_connection_fetch = IsNewConnectionFetch::No); | 
					
						
							| 
									
										
										
										
											2023-03-22 23:56:11 +01:00
										 |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> nonstandard_resource_loader_file_or_http_network_fetch(JS::Realm&, Infrastructure::FetchParams const&, IncludeCredentials include_credentials = IncludeCredentials::No, IsNewConnectionFetch is_new_connection_fetch = IsNewConnectionFetch::No); | 
					
						
							| 
									
										
										
										
											2023-02-25 10:44:51 -07:00
										 |  |  | WebIDL::ExceptionOr<JS::NonnullGCPtr<PendingResponse>> cors_preflight_fetch(JS::Realm&, Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:54:14 +01:00
										 |  |  | void set_sec_fetch_dest_header(Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:55:44 +01:00
										 |  |  | void set_sec_fetch_mode_header(Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:56:30 +01:00
										 |  |  | void set_sec_fetch_site_header(Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:56:57 +01:00
										 |  |  | void set_sec_fetch_user_header(Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2024-04-29 20:57:34 +01:00
										 |  |  | void append_fetch_metadata_headers_for_request(Infrastructure::Request&); | 
					
						
							| 
									
										
										
										
											2022-10-23 22:16:14 +01:00
										 |  |  | } |