OLD | NEW |
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch-0 | 56 // Fetch API Spec: https://fetch.spec.whatwg.org/#cors-preflight-fetch-0 |
57 static AtomicString CreateAccessControlRequestHeadersHeader( | 57 static AtomicString CreateAccessControlRequestHeadersHeader( |
58 const HTTPHeaderMap& headers) { | 58 const HTTPHeaderMap& headers) { |
59 Vector<String> filtered_headers; | 59 Vector<String> filtered_headers; |
60 for (const auto& header : headers) { | 60 for (const auto& header : headers) { |
61 if (FetchUtils::IsSimpleHeader(header.key, header.value)) { | 61 if (FetchUtils::IsSimpleHeader(header.key, header.value)) { |
62 // Exclude simple headers. | 62 // Exclude simple headers. |
63 continue; | 63 continue; |
64 } | 64 } |
65 if (EqualIgnoringCase(header.key, "referer")) { | 65 if (DeprecatedEqualIgnoringCase(header.key, "referer")) { |
66 // When the request is from a Worker, referrer header was added by | 66 // When the request is from a Worker, referrer header was added by |
67 // WorkerThreadableLoader. But it should not be added to | 67 // WorkerThreadableLoader. But it should not be added to |
68 // Access-Control-Request-Headers header. | 68 // Access-Control-Request-Headers header. |
69 continue; | 69 continue; |
70 } | 70 } |
71 filtered_headers.push_back(header.key.DeprecatedLower()); | 71 filtered_headers.push_back(header.key.DeprecatedLower()); |
72 } | 72 } |
73 if (!filtered_headers.size()) | 73 if (!filtered_headers.size()) |
74 return g_null_atom; | 74 return g_null_atom; |
75 | 75 |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 return kPreflightSuccess; | 346 return kPreflightSuccess; |
347 } | 347 } |
348 | 348 |
349 CrossOriginAccessControl::PreflightStatus | 349 CrossOriginAccessControl::PreflightStatus |
350 CrossOriginAccessControl::CheckExternalPreflight( | 350 CrossOriginAccessControl::CheckExternalPreflight( |
351 const ResourceResponse& response) { | 351 const ResourceResponse& response) { |
352 AtomicString result = | 352 AtomicString result = |
353 response.HttpHeaderField(HTTPNames::Access_Control_Allow_External); | 353 response.HttpHeaderField(HTTPNames::Access_Control_Allow_External); |
354 if (result.IsNull()) | 354 if (result.IsNull()) |
355 return kPreflightMissingAllowExternal; | 355 return kPreflightMissingAllowExternal; |
356 if (!EqualIgnoringCase(result, "true")) | 356 if (!DeprecatedEqualIgnoringCase(result, "true")) |
357 return kPreflightInvalidAllowExternal; | 357 return kPreflightInvalidAllowExternal; |
358 return kPreflightSuccess; | 358 return kPreflightSuccess; |
359 } | 359 } |
360 | 360 |
361 void CrossOriginAccessControl::PreflightErrorString( | 361 void CrossOriginAccessControl::PreflightErrorString( |
362 StringBuilder& builder, | 362 StringBuilder& builder, |
363 CrossOriginAccessControl::PreflightStatus status, | 363 CrossOriginAccessControl::PreflightStatus status, |
364 const ResourceResponse& response) { | 364 const ResourceResponse& response) { |
365 switch (status) { | 365 switch (status) { |
366 case kPreflightInvalidStatus: { | 366 case kPreflightInvalidStatus: { |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // | 537 // |
538 // This is equivalent to the step 2 in | 538 // This is equivalent to the step 2 in |
539 // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch | 539 // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch |
540 if (options.credentials_requested == kClientDidNotRequestCredentials) | 540 if (options.credentials_requested == kClientDidNotRequestCredentials) |
541 options.allow_credentials = kDoNotAllowStoredCredentials; | 541 options.allow_credentials = kDoNotAllowStoredCredentials; |
542 } | 542 } |
543 return true; | 543 return true; |
544 } | 544 } |
545 | 545 |
546 } // namespace blink | 546 } // namespace blink |
OLD | NEW |