Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: Source/core/fetch/CrossOriginAccessControl.cpp

Issue 356723003: Add 'XHR' to the Resource::Type enum, and use it for XHR requests. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Preflight. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 request.setHTTPOrigin(securityOrigin->toAtomicString()); 109 request.setHTTPOrigin(securityOrigin->toAtomicString());
110 } 110 }
111 111
112 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin) 112 ResourceRequest createAccessControlPreflightRequest(const ResourceRequest& reque st, SecurityOrigin* securityOrigin)
113 { 113 {
114 ResourceRequest preflightRequest(request.url()); 114 ResourceRequest preflightRequest(request.url());
115 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials); 115 updateRequestForAccessControl(preflightRequest, securityOrigin, DoNotAllowSt oredCredentials);
116 preflightRequest.setHTTPMethod("OPTIONS"); 116 preflightRequest.setHTTPMethod("OPTIONS");
117 preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", request .httpMethod()); 117 preflightRequest.setHTTPHeaderField("Access-Control-Request-Method", request .httpMethod());
118 preflightRequest.setPriority(request.priority()); 118 preflightRequest.setPriority(request.priority());
119 preflightRequest.setTargetType(request.targetType());
119 120
120 const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields(); 121 const HTTPHeaderMap& requestHeaderFields = request.httpHeaderFields();
121 122
122 if (requestHeaderFields.size() > 0) { 123 if (requestHeaderFields.size() > 0) {
123 StringBuilder headerBuffer; 124 StringBuilder headerBuffer;
124 HTTPHeaderMap::const_iterator it = requestHeaderFields.begin(); 125 HTTPHeaderMap::const_iterator it = requestHeaderFields.begin();
125 headerBuffer.append(it->key); 126 headerBuffer.append(it->key);
126 ++it; 127 ++it;
127 128
128 HTTPHeaderMap::const_iterator end = requestHeaderFields.end(); 129 HTTPHeaderMap::const_iterator end = requestHeaderFields.end();
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 request.setHTTPOrigin(securityOrigin->toAtomicString()); 267 request.setHTTPOrigin(securityOrigin->toAtomicString());
267 // If the user didn't request credentials in the first place, update our 268 // If the user didn't request credentials in the first place, update our
268 // state so we neither request them nor expect they must be allowed. 269 // state so we neither request them nor expect they must be allowed.
269 if (options.credentialsRequested == ClientDidNotRequestCredentials) 270 if (options.credentialsRequested == ClientDidNotRequestCredentials)
270 options.allowCredentials = DoNotAllowStoredCredentials; 271 options.allowCredentials = DoNotAllowStoredCredentials;
271 } 272 }
272 return true; 273 return true;
273 } 274 }
274 275
275 } // namespace WebCore 276 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/http/tests/security/mixedContent/insecure-image-in-iframe-expected.txt ('k') | Source/core/fetch/RawResource.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698