diff --git a/.gitignore b/.gitignore index 68c99713..ed3648c1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,9 @@ webcache/ examples/screenshot.png examples/pyinstaller/build/ examples/pyinstaller/dist/ +examples/GPUCache/ +examples/blob_storage/ +examples/webrtc_event_logs/ +unittests/GPUCache/ +unittests/blob_storage/ +unittests/webrtc_event_logs/ diff --git a/api/Request.md b/api/Request.md index 961ef8b0..3fcf5032 100644 --- a/api/Request.md +++ b/api/Request.md @@ -166,18 +166,20 @@ be removed and ignored. Get the flags used in combination with WebRequest. -Available flags (access via `cefpython.Request.Flags["xxx"]`): +Available flags below. Can be accessed via `cefpython.Request.Flags["xxx"]`. +These flags are also defined as constants starting with "UR_FLAG_" +in the cefpython module.requ * **None** - Default behavior. -* **SkipCache** - If set the cache will be skipped when handling the request. - Setting this value is equivalent to specifying the "Cache-Control: no-cache" - request header. Setting this value in combination with UR_FLAG_ONLY_FROM_CACHE - will cause the request to fail. -* **AllowCachedCredentials** - If set user name, password, and cookies may be - sent with the request, and cookies may be saved from the response. +* **SkipCache** - If set the cache will be skipped when handling the request. Setting this value is equivalent to specifying the "Cache-Control: no-cache" request header. Setting this value in combination with UR_FLAG_ONLY_FROM_CACHE will cause the request to fail. +* **OnlyFromCache** - If set the request will fail if it cannot be served from the cache (or some equivalent local store). Setting this value is equivalent to specifying the "Cache-Control: only-if-cached" request header. Setting this value in combination with UR_FLAG_SKIP_CACHE will cause the request to fail. +* **AllowStoredCredentials** - If set user name, password, and cookies may be sent with the request, and cookies may be saved from the response. * **ReportUploadProgress** - If set upload progress events will be generated when a request has a body. * **NoDownloadData** - If set the [WebRequestClient](WebRequestClient.md)::`OnDownloadData` method will not be called. * **NoRetryOn5xx** - If set 5xx redirect errors will be propagated to the observer instead of automatically re-tried. This currently only applies for requests originated in the browser process. +* **StopOnRedirect** - If set 3XX responses will cause the fetch to halt immediately rather than continue through the redirect. + + ### SetFlags diff --git a/docs/Migration-guide.md b/docs/Migration-guide.md index 2361a8ff..04f39f0d 100644 --- a/docs/Migration-guide.md +++ b/docs/Migration-guide.md @@ -43,6 +43,7 @@ Table of contents: * [v66+ Window transparency changes](#v66-window-transparency-changes) * [v66+ BrowserSettings.javascript_open_windows_disallowed option was removed](#v66-browsersettingsjavascript_open_windows_disallowed-option-was-removed) * [v66+ Threads removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE](#v66-threads-removed-tid_db-tid_process_launcher-tid_cache) +* [v66+ cef.Request.Flags changed](#v66-cefrequestflags-changed) @@ -361,3 +362,17 @@ were removed: TID_DB, TID_PROCESS_LAUNCHER, TID_CACHE. New threads were added, see cefpython.[PostTask](../api/cefpython.md#posttask) description for a complete list of threads. + +## v66+ cef.Request.Flags changed + +Flags removed: +- AllowCachedCredentials + +Flags added: +- OnlyFromCache +- AllowStoredCredentials +- StopOnRedirect + +See a complete list of flags in the description of +cef.Request.[GetFlags](../api/Request.md#getflags) method. + diff --git a/src/cef_v59..v66_changes.txt b/src/cef_v59..v66_changes.txt index 8a5cf161..3443fe9d 100644 --- a/src/cef_v59..v66_changes.txt +++ b/src/cef_v59..v66_changes.txt @@ -53,6 +53,13 @@ internal/cef_types.h - + Added threads: TID_FILE_BACKGROUND, TID_FILE_USER_VISIBLE ++ cef_urlrequest.h +- + cef_urlrequest_flags_t: + - + Add: UR_FLAG_ONLY_FROM_CACHE, UR_FLAG_ALLOW_STORED_CREDENTIALS, + UR_FLAG_STOP_ON_REDIRECT + - + Remove: UR_FLAG_ALLOW_CACHED_CREDENTIALS + + NEW FEATURES ------------ @@ -133,9 +140,6 @@ cef_server.h - CefServer: a web server that supports HTTP and WebSocket requests - CefServerHandler -cef_urlrequest.h -- ResponseWasCached - cef_v8.h - CefV8ArrayBufferReleaseCallback - CefV8Value new methods: diff --git a/src/extern/cef/cef_types.pxd b/src/extern/cef/cef_types.pxd index 2ce54c0f..e70ec5ac 100644 --- a/src/extern/cef/cef_types.pxd +++ b/src/extern/cef/cef_types.pxd @@ -124,7 +124,7 @@ cdef extern from "include/internal/cef_types.h": TID_UI, TID_FILE_BACKGROUND TID_FILE, - TID_FILE_USER_VISIBLE + TID_FILE_USER_VISIBLE, TID_FILE_USER_BLOCKING, TID_IO, TID_RENDERER @@ -160,12 +160,14 @@ cdef extern from "include/internal/cef_types.h": # WebRequest ctypedef enum cef_urlrequest_flags_t: - UR_FLAG_NONE = 0, - UR_FLAG_SKIP_CACHE = 1 << 0, - UR_FLAG_ALLOW_CACHED_CREDENTIALS = 1 << 1, - UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3, - UR_FLAG_NO_DOWNLOAD_DATA = 1 << 6, - UR_FLAG_NO_RETRY_ON_5XX = 1 << 7, + UR_FLAG_NONE = 0, + UR_FLAG_SKIP_CACHE = 1 << 0, + UR_FLAG_ONLY_FROM_CACHE = 1 << 1, + UR_FLAG_ALLOW_STORED_CREDENTIALS = 1 << 2, + UR_FLAG_REPORT_UPLOAD_PROGRESS = 1 << 3, + UR_FLAG_NO_DOWNLOAD_DATA = 1 << 4, + UR_FLAG_NO_RETRY_ON_5XX = 1 << 5, + UR_FLAG_STOP_ON_REDIRECT = 1 << 6, # CefListValue, CefDictionaryValue - types. ctypedef enum cef_value_type_t: diff --git a/src/request.pyx b/src/request.pyx index 95bf45ba..0f770b20 100644 --- a/src/request.pyx +++ b/src/request.pyx @@ -4,17 +4,35 @@ include "cefpython.pyx" +# noinspection PyUnresolvedReferences +cimport cef_types + +# cef_urlrequest_flags_t +UR_FLAG_NONE = cef_types.UR_FLAG_NONE +UR_FLAG_SKIP_CACHE = cef_types.UR_FLAG_SKIP_CACHE +UR_FLAG_ONLY_FROM_CACHE = cef_types.UR_FLAG_ONLY_FROM_CACHE +UR_FLAG_ALLOW_STORED_CREDENTIALS = cef_types.UR_FLAG_ALLOW_STORED_CREDENTIALS +UR_FLAG_REPORT_UPLOAD_PROGRESS = cef_types.UR_FLAG_REPORT_UPLOAD_PROGRESS +UR_FLAG_NO_DOWNLOAD_DATA = cef_types.UR_FLAG_NO_DOWNLOAD_DATA +UR_FLAG_NO_RETRY_ON_5XX = cef_types.UR_FLAG_NO_RETRY_ON_5XX +UR_FLAG_STOP_ON_REDIRECT = cef_types.UR_FLAG_STOP_ON_REDIRECT + + class Request: + # TODO: autocomplete in PyCharm doesn't work for these flags Flags = { "None": cef_types.UR_FLAG_NONE, "SkipCache": cef_types.UR_FLAG_SKIP_CACHE, - "AllowCachedCredentials": cef_types.UR_FLAG_ALLOW_CACHED_CREDENTIALS, - "AllowCookies": 0, # keep for BC + "OnlyFromCache": cef_types.UR_FLAG_ONLY_FROM_CACHE, + "AllowCachedCredentials": 0, # keep dummy for BC + "AllowStoredCredentials": cef_types.UR_FLAG_ALLOW_STORED_CREDENTIALS, + "AllowCookies": 0, # keep dummy for BC "ReportUploadProgress": cef_types.UR_FLAG_REPORT_UPLOAD_PROGRESS, - "ReportLoadTiming": 0, # keep for BC - "ReportRawHeaders": 0, # keep for BC + "ReportLoadTiming": 0, # keep dummy for BC + "ReportRawHeaders": 0, # keep dummy for BC "NoDownloadData": cef_types.UR_FLAG_NO_DOWNLOAD_DATA, "NoRetryOn5xx": cef_types.UR_FLAG_NO_RETRY_ON_5XX, + "StopOnRedirect": cef_types.UR_FLAG_STOP_ON_REDIRECT, } def __init__(self): diff --git a/src/subprocess/print_handler_gtk.cpp b/src/subprocess/print_handler_gtk.cpp index cfccbaff..18c8c1c4 100644 --- a/src/subprocess/print_handler_gtk.cpp +++ b/src/subprocess/print_handler_gtk.cpp @@ -13,9 +13,11 @@ #include #include +#include "include/base/cef_bind.h" #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" #include "include/wrapper/cef_helpers.h" +#include "include/wrapper/cef_closure_task.h" namespace { diff --git a/src/subprocess/print_handler_gtk.patch b/src/subprocess/print_handler_gtk.patch index 98f49960..75dcff42 100644 --- a/src/subprocess/print_handler_gtk.patch +++ b/src/subprocess/print_handler_gtk.patch @@ -1,8 +1,8 @@ diff --git print_handler_gtk.cc print_handler_gtk.cc -index 9a822b7a..cfccbaff 100644 +index 9a822b7a..18c8c1c4 100644 --- print_handler_gtk.cc +++ print_handler_gtk.cc -@@ -1,9 +1,12 @@ +@@ -1,22 +1,23 @@ +// COPIED from upstream "cef/tests/cefclient/browser/" directory +// with minor modifications. See the .patch file in current directory. + @@ -16,18 +16,22 @@ index 9a822b7a..cfccbaff 100644 #include -@@ -14,10 +17,6 @@ + #include + #include + ++#include "include/base/cef_bind.h" + #include "include/base/cef_logging.h" #include "include/base/cef_macros.h" #include "include/wrapper/cef_helpers.h" - +- -#include "tests/cefclient/browser/root_window.h" - -namespace client { -- ++#include "include/wrapper/cef_closure_task.h" + namespace { - // CUPS Duplex attribute and values. -@@ -431,10 +430,12 @@ struct ClientPrintHandlerGtk::PrintHandler { +@@ -431,10 +432,12 @@ struct ClientPrintHandlerGtk::PrintHandler { // Returns the GtkWindow* for the browser. Will return NULL when using the // Views framework. GtkWindow* GetWindow() { @@ -44,7 +48,7 @@ index 9a822b7a..cfccbaff 100644 return NULL; } -@@ -626,5 +627,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler( +@@ -626,5 +629,3 @@ ClientPrintHandlerGtk::PrintHandler* ClientPrintHandlerGtk::GetPrintHandler( DCHECK(it != print_handler_map_.end()); return it->second; } diff --git a/src/utils.pyx b/src/utils.pyx index 2832d730..03bfd1e3 100644 --- a/src/utils.pyx +++ b/src/utils.pyx @@ -19,7 +19,7 @@ g_browserProcessThreads = [ TID_UI, TID_FILE_BACKGROUND, TID_FILE, - TID_FILE_USER_VISIBLE + TID_FILE_USER_VISIBLE, TID_FILE_USER_BLOCKING, TID_IO, ]