| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 } | 392 } |
| 393 } | 393 } |
| 394 | 394 |
| 395 void parseAccessControlExposeHeadersAllowList(const String& headerValue, | 395 void parseAccessControlExposeHeadersAllowList(const String& headerValue, |
| 396 HTTPHeaderSet& headerSet) { | 396 HTTPHeaderSet& headerSet) { |
| 397 Vector<String> headers; | 397 Vector<String> headers; |
| 398 headerValue.split(',', false, headers); | 398 headerValue.split(',', false, headers); |
| 399 for (unsigned headerCount = 0; headerCount < headers.size(); headerCount++) { | 399 for (unsigned headerCount = 0; headerCount < headers.size(); headerCount++) { |
| 400 String strippedHeader = headers[headerCount].stripWhiteSpace(); | 400 String strippedHeader = headers[headerCount].stripWhiteSpace(); |
| 401 if (!strippedHeader.isEmpty()) | 401 if (!strippedHeader.isEmpty()) |
| 402 headerSet.add(strippedHeader); | 402 headerSet.insert(strippedHeader); |
| 403 } | 403 } |
| 404 } | 404 } |
| 405 | 405 |
| 406 void extractCorsExposedHeaderNamesList(const ResourceResponse& response, | 406 void extractCorsExposedHeaderNamesList(const ResourceResponse& response, |
| 407 HTTPHeaderSet& headerSet) { | 407 HTTPHeaderSet& headerSet) { |
| 408 // If a response was fetched via a service worker, it will always have | 408 // If a response was fetched via a service worker, it will always have |
| 409 // corsExposedHeaderNames set, either from the Access-Control-Expose-Headers | 409 // corsExposedHeaderNames set, either from the Access-Control-Expose-Headers |
| 410 // header, or explicitly via foreign fetch. For requests that didn't come from | 410 // header, or explicitly via foreign fetch. For requests that didn't come from |
| 411 // a service worker, foreign fetch doesn't apply so just parse the CORS | 411 // a service worker, foreign fetch doesn't apply so just parse the CORS |
| 412 // header. | 412 // header. |
| 413 if (response.wasFetchedViaServiceWorker()) { | 413 if (response.wasFetchedViaServiceWorker()) { |
| 414 for (const auto& header : response.corsExposedHeaderNames()) | 414 for (const auto& header : response.corsExposedHeaderNames()) |
| 415 headerSet.add(header); | 415 headerSet.insert(header); |
| 416 return; | 416 return; |
| 417 } | 417 } |
| 418 parseAccessControlExposeHeadersAllowList( | 418 parseAccessControlExposeHeadersAllowList( |
| 419 response.httpHeaderField(HTTPNames::Access_Control_Expose_Headers), | 419 response.httpHeaderField(HTTPNames::Access_Control_Expose_Headers), |
| 420 headerSet); | 420 headerSet); |
| 421 } | 421 } |
| 422 | 422 |
| 423 CrossOriginAccessControl::RedirectStatus | 423 CrossOriginAccessControl::RedirectStatus |
| 424 CrossOriginAccessControl::checkRedirectLocation(const KURL& requestURL) { | 424 CrossOriginAccessControl::checkRedirectLocation(const KURL& requestURL) { |
| 425 // Block non HTTP(S) schemes as specified in the step 4 in | 425 // Block non HTTP(S) schemes as specified in the step 4 in |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 // | 532 // |
| 533 // This is equivalent to the step 2 in | 533 // This is equivalent to the step 2 in |
| 534 // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch | 534 // https://fetch.spec.whatwg.org/#http-network-or-cache-fetch |
| 535 if (options.credentialsRequested == ClientDidNotRequestCredentials) | 535 if (options.credentialsRequested == ClientDidNotRequestCredentials) |
| 536 options.allowCredentials = DoNotAllowStoredCredentials; | 536 options.allowCredentials = DoNotAllowStoredCredentials; |
| 537 } | 537 } |
| 538 return true; | 538 return true; |
| 539 } | 539 } |
| 540 | 540 |
| 541 } // namespace blink | 541 } // namespace blink |
| OLD | NEW |