mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Implement improvements for request handling (issue #1327).
- Add a new CefRequestHandler::OnResourceResponse() method for inspecting the request/response headers and potentially restarting or redirecting the request. - Add a new CefRequest::GetIdentifier() method for tracking a request across multiple CefRequestHandler callbacks. - Pass a CefRequest object instead of just the old URL to CefRequestHandler::OnResourceRedirect(). git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@2073 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "base/strings/stringprintf.h"
|
||||
#include "net/http/http_request_headers.h"
|
||||
#include "net/http/http_response_headers.h"
|
||||
#include "net/url_request/url_request.h"
|
||||
#include "third_party/WebKit/public/platform/WebHTTPHeaderVisitor.h"
|
||||
#include "third_party/WebKit/public/platform/WebString.h"
|
||||
#include "third_party/WebKit/public/platform/WebURLResponse.h"
|
||||
@@ -152,6 +153,7 @@ net::HttpResponseHeaders* CefResponseImpl::GetResponseHeaders() {
|
||||
void CefResponseImpl::SetResponseHeaders(
|
||||
const net::HttpResponseHeaders& headers) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
CHECK_READONLY_RETURN_VOID();
|
||||
|
||||
header_map_.empty();
|
||||
|
||||
@@ -166,6 +168,8 @@ void CefResponseImpl::SetResponseHeaders(
|
||||
std::string mime_type;
|
||||
if (headers.GetMimeType(&mime_type))
|
||||
mime_type_ = mime_type;
|
||||
else
|
||||
mime_type_.clear();
|
||||
}
|
||||
|
||||
void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
||||
@@ -199,6 +203,14 @@ void CefResponseImpl::Set(const blink::WebURLResponse& response) {
|
||||
response.visitHTTPHeaderFields(&visitor);
|
||||
}
|
||||
|
||||
void CefResponseImpl::Set(const net::URLRequest* request) {
|
||||
DCHECK(request);
|
||||
|
||||
const net::HttpResponseHeaders* headers = request->response_headers();
|
||||
if (headers)
|
||||
SetResponseHeaders(*headers);
|
||||
}
|
||||
|
||||
void CefResponseImpl::SetReadOnly(bool read_only) {
|
||||
base::AutoLock lock_scope(lock_);
|
||||
read_only_ = read_only;
|
||||
|
Reference in New Issue
Block a user