OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013, Intel Corporation | 3 * Copyright (C) 2013, Intel Corporation |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
7 * met: | 7 * met: |
8 * | 8 * |
9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 // |this| may be dead here. | 153 // |this| may be dead here. |
154 return; | 154 return; |
155 } | 155 } |
156 | 156 |
157 m_requestStartedSeconds = monotonicallyIncreasingTime(); | 157 m_requestStartedSeconds = monotonicallyIncreasingTime(); |
158 | 158 |
159 // Save any CORS simple headers on the request here. If this request redirec
ts cross-origin, we cancel the old request | 159 // Save any CORS simple headers on the request here. If this request redirec
ts cross-origin, we cancel the old request |
160 // create a new one, and copy these headers. | 160 // create a new one, and copy these headers. |
161 const HTTPHeaderMap& headerMap = request.httpHeaderFields(); | 161 const HTTPHeaderMap& headerMap = request.httpHeaderFields(); |
162 for (const auto& header : headerMap) { | 162 for (const auto& header : headerMap) { |
163 if (FetchUtils::isSimpleHeader(header.key, header.value)) | 163 if (FetchUtils::isSimpleHeader(header.key, header.value)) { |
164 m_simpleRequestHeaders.add(header.key, header.value); | 164 m_simpleRequestHeaders.add(header.key, header.value); |
| 165 } else if (equalIgnoringCase(header.key, "range") && m_options.crossOrig
inRequestPolicy == UseAccessControl && m_options.preflightPolicy == PreventPrefl
ight) { |
| 166 // Allow an exception for the "range" header for when CORS callers r
equest no preflight, this ensures cross-origin |
| 167 // redirects work correctly for crossOrigin enabled WebURLRequest::R
equestContextVideo type requests. |
| 168 m_simpleRequestHeaders.add(header.key, header.value); |
| 169 } |
165 } | 170 } |
166 | 171 |
167 // DocumentThreadableLoader is used by all javascript initiated fetch, so | 172 // DocumentThreadableLoader is used by all javascript initiated fetch, so |
168 // we use this chance to record non-GET fetch script requests. | 173 // we use this chance to record non-GET fetch script requests. |
169 // However, this is based on the following assumptions, so please be careful | 174 // However, this is based on the following assumptions, so please be careful |
170 // when adding similar logic: | 175 // when adding similar logic: |
171 // - ThreadableLoader is used as backend for all javascript initiated networ
k | 176 // - ThreadableLoader is used as backend for all javascript initiated networ
k |
172 // fetches. | 177 // fetches. |
173 // - Note that ThreadableLoader is also used for non-network fetch such as | 178 // - Note that ThreadableLoader is also used for non-network fetch such as |
174 // FileReaderLoader. However it emulates GET method so signal is not | 179 // FileReaderLoader. However it emulates GET method so signal is not |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
865 return DoNotAllowStoredCredentials; | 870 return DoNotAllowStoredCredentials; |
866 return m_resourceLoaderOptions.allowCredentials; | 871 return m_resourceLoaderOptions.allowCredentials; |
867 } | 872 } |
868 | 873 |
869 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const | 874 SecurityOrigin* DocumentThreadableLoader::securityOrigin() const |
870 { | 875 { |
871 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); | 876 return m_securityOrigin ? m_securityOrigin.get() : m_document.securityOrigin
(); |
872 } | 877 } |
873 | 878 |
874 } // namespace blink | 879 } // namespace blink |
OLD | NEW |