@@ -368,9 +368,10 @@ NonnullOwnPtr<Request> Request::fetch(
368368 NonnullRefPtr<HTTP ::HeaderList> request_headers,
369369 ByteBuffer request_body,
370370 HTTP ::Cookie::IncludeCredentials include_credentials,
371- ByteString alt_svc_cache_path)
371+ ByteString alt_svc_cache_path,
372+ Proxy::ProxyData proxy_data)
372373{
373- auto request = adopt_own (*new Request { request_id, RequestType::Fetch, disk_cache, cache_mode, client, curl_multi, resolver, move (url), move (method), move (request_headers), move (request_body), include_credentials, move (alt_svc_cache_path) });
374+ auto request = adopt_own (*new Request { request_id, RequestType::Fetch, disk_cache, cache_mode, client, curl_multi, resolver, move (url), move (method), move (request_headers), move (request_body), include_credentials, move (alt_svc_cache_path), move (proxy_data) });
374375 request->process ();
375376
376377 return request;
@@ -401,9 +402,10 @@ NonnullOwnPtr<Request> Request::revalidate(
401402 NonnullRefPtr<HTTP ::HeaderList> request_headers,
402403 ByteBuffer request_body,
403404 HTTP ::Cookie::IncludeCredentials include_credentials,
404- ByteString alt_svc_cache_path)
405+ ByteString alt_svc_cache_path,
406+ Proxy::ProxyData proxy_data)
405407{
406- auto request = adopt_own (*new Request { request_id, RequestType::BackgroundRevalidation, disk_cache, HTTP ::CacheMode::Default, client, curl_multi, resolver, move (url), move (method), move (request_headers), move (request_body), include_credentials, move (alt_svc_cache_path) });
408+ auto request = adopt_own (*new Request { request_id, RequestType::BackgroundRevalidation, disk_cache, HTTP ::CacheMode::Default, client, curl_multi, resolver, move (url), move (method), move (request_headers), move (request_body), include_credentials, move (alt_svc_cache_path), move (proxy_data) });
407409 request->process ();
408410
409411 return request;
@@ -422,7 +424,8 @@ Request::Request(
422424 NonnullRefPtr<HTTP ::HeaderList> request_headers,
423425 ByteBuffer request_body,
424426 HTTP ::Cookie::IncludeCredentials include_credentials,
425- ByteString alt_svc_cache_path)
427+ ByteString alt_svc_cache_path,
428+ Proxy::ProxyData proxy_data)
426429 : m_request_id(request_id)
427430 , m_type(type)
428431 , m_disk_cache(disk_cache)
@@ -436,6 +439,7 @@ Request::Request(
436439 , m_request_body(move(request_body))
437440 , m_include_credentials(include_credentials)
438441 , m_alt_svc_cache_path(move(alt_svc_cache_path))
442+ , m_proxy_data(move(proxy_data))
439443 , m_response_headers(HTTP ::HeaderList::create())
440444{
441445 if constexpr (REQUESTSERVER_WIRE_DEBUG )
@@ -585,6 +589,15 @@ void Request::process()
585589
586590void Request::transition_to_network_lookup ()
587591{
592+ if (!m_proxy_data.is_direct ()) {
593+ // Client has provided proxy data, skip proxy resolution
594+ if (m_type == RequestType::Connect)
595+ transition_to_state (State::Connect);
596+ else
597+ transition_to_state (State::RetrieveCookie);
598+ return ;
599+ }
600+
588601 if (Proxy::use_system_proxy ()) {
589602 auto proxies = Proxy::get_proxies_for_url (m_url);
590603 if (!proxies.is_empty ()) {
@@ -626,7 +639,7 @@ void Request::handle_initial_state()
626639
627640 if (m_cache_entry_reader.has_value ()) {
628641 if (m_cache_entry_reader->revalidation_type () == HTTP ::CacheEntryReader::RevalidationType::StaleWhileRevalidate)
629- m_client.start_revalidation_request ({}, m_method, m_url, m_request_headers, m_request_body, m_include_credentials);
642+ m_client.start_revalidation_request ({}, m_method, m_url, m_request_headers, m_request_body, m_include_credentials, m_proxy_data );
630643
631644 if (is_revalidation_request ())
632645 transition_to_network_lookup ();
0 commit comments