Add NetworkService support for CefURLRequest (see issue #2622).

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.
This commit is contained in:
Marshall Greenblatt
2019-05-10 18:14:48 -04:00
parent f9b042c375
commit ba0e1b5719
43 changed files with 1637 additions and 344 deletions

View File

@ -45,6 +45,8 @@
#include "include/cef_string_visitor.h"
class CefBrowser;
class CefURLRequest;
class CefURLRequestClient;
class CefV8Context;
///
@ -220,6 +222,32 @@ class CefFrame : public virtual CefBaseRefCounted {
///
/*--cef()--*/
virtual void VisitDOM(CefRefPtr<CefDOMVisitor> visitor) = 0;
///
// Create a new URL request that will be treated as originating from this
// frame and the associated browser. This request may be intercepted by the
// client via CefResourceRequestHandler or CefSchemeHandlerFactory. Use
// CefURLRequest::Create instead if you do not want the request to have this
// association, in which case it may be handled differently (see documentation
// on that method). Requests may originate from both the browser process and
// the render process.
//
// For requests originating from the browser process:
// - POST data may only contain a single element of type PDE_TYPE_FILE or
// PDE_TYPE_BYTES.
// For requests originating from the render process:
// - POST data may only contain a single element of type PDE_TYPE_BYTES.
// - If the response contains Content-Disposition or Mime-Type header values
// that would not normally be rendered then the response may receive
// special handling inside the browser (for example, via the file download
// code path instead of the URL request code path).
//
// The |request| object will be marked as read-only after calling this method.
///
/*--cef()--*/
virtual CefRefPtr<CefURLRequest> CreateURLRequest(
CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client) = 0;
};
#endif // CEF_INCLUDE_CEF_FRAME_H_