mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-15 10:58:33 +01:00
ba0e1b5719
Requests created using CefURLRequest::Create are not associated with a browser/frame. When originating from the render process these requests cannot be intercepted and consequently only http(s) and blob requests are supported. To work around this limitation a new CefFrame::CreateURLRequest method has been added that allows the request to be associated with that browser/frame for interception purposes. This change also fixes an issue with the NetworkService implementation where redirected requests could result in two parallel requests being sent to the target server. To test: URLRequestTest.* tests pass with NetworkService enabled.
75 lines
2.4 KiB
C++
75 lines
2.4 KiB
C++
// Copyright (c) 2019 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#ifndef CEF_LIBCEF_COMMON_NET_SERVICE_NET_SERVICE_UTIL_H_
|
|
#define CEF_LIBCEF_COMMON_NET_SERVICE_NET_SERVICE_UTIL_H_
|
|
|
|
#include <map>
|
|
#include <string>
|
|
|
|
#include "include/internal/cef_types_wrappers.h"
|
|
|
|
namespace net {
|
|
class CanonicalCookie;
|
|
class HttpResponseHeaders;
|
|
struct RedirectInfo;
|
|
} // namespace net
|
|
|
|
namespace network {
|
|
struct ResourceRequest;
|
|
struct ResourceResponseHead;
|
|
} // namespace network
|
|
|
|
class GURL;
|
|
|
|
namespace net_service {
|
|
|
|
// HTTP header names.
|
|
extern const char kHTTPLocationHeaderName[];
|
|
extern const char kHTTPSetCookieHeaderName[];
|
|
|
|
// HTTP header values.
|
|
extern const char kContentTypeApplicationFormURLEncoded[];
|
|
|
|
// Make a header name/value pair.
|
|
std::string MakeHeader(const std::string& name, const std::string& value);
|
|
|
|
// Make an HTTP response status line.
|
|
// Set |for_replacement| to true if the result will be passed to
|
|
// HttpResponseHeaders::ReplaceStatusLine and false if the result will
|
|
// be passed to the HttpResponseHeaders constructor.
|
|
std::string MakeStatusLine(int status_code,
|
|
const std::string& status_text,
|
|
bool for_replacement);
|
|
|
|
// Make an HTTP Content-Type response header value.
|
|
std::string MakeContentTypeValue(const std::string& mime_type,
|
|
const std::string& charset);
|
|
|
|
// Make a new HttpResponseHeaders object.
|
|
net::HttpResponseHeaders* MakeResponseHeaders(
|
|
int status_code,
|
|
const std::string& status_text,
|
|
const std::string& mime_type,
|
|
const std::string& charset,
|
|
int64_t content_length,
|
|
const std::multimap<std::string, std::string>& extra_headers,
|
|
bool allow_existing_header_override);
|
|
|
|
// Make a RedirectInfo structure.
|
|
net::RedirectInfo MakeRedirectInfo(const network::ResourceRequest& request,
|
|
const net::HttpResponseHeaders* headers,
|
|
const GURL& new_location,
|
|
int status_code);
|
|
|
|
// Populate |cookie|. Returns true on success.
|
|
bool MakeCefCookie(const net::CanonicalCookie& cc, CefCookie& cookie);
|
|
bool MakeCefCookie(const GURL& url,
|
|
const std::string& cookie_line,
|
|
CefCookie& cookie);
|
|
|
|
} // namespace net_service
|
|
|
|
#endif // CEF_LIBCEF_COMMON_NET_SERVICE_NET_SERVICE_UTIL_H_
|