OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2003, 2006 Apple Computer, Inc. All rights reserved. |
3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. |
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 | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 | 307 |
308 return true; | 308 return true; |
309 } | 309 } |
310 | 310 |
311 bool ResourceRequest::isConditional() const | 311 bool ResourceRequest::isConditional() const |
312 { | 312 { |
313 return (m_httpHeaderFields.contains("If-Match") | 313 return (m_httpHeaderFields.contains("If-Match") |
314 || m_httpHeaderFields.contains("If-Modified-Since") | 314 || m_httpHeaderFields.contains("If-Modified-Since") |
315 || m_httpHeaderFields.contains("If-None-Match") | 315 || m_httpHeaderFields.contains("If-None-Match") |
316 || m_httpHeaderFields.contains("If-Range") | 316 || m_httpHeaderFields.contains("If-Range") |
317 || m_httpHeaderFields.contains("If-Unmodified-Since") | 317 || m_httpHeaderFields.contains("If-Unmodified-Since")); |
318 || m_httpHeaderFields.contains("Cache-Control")); | 318 } |
| 319 |
| 320 |
| 321 static const AtomicString& cacheControlHeaderString() |
| 322 { |
| 323 DEFINE_STATIC_LOCAL(const AtomicString, cacheControlHeader, ("cache-control"
, AtomicString::ConstructFromLiteral)); |
| 324 return cacheControlHeader; |
| 325 } |
| 326 |
| 327 static const AtomicString& pragmaHeaderString() |
| 328 { |
| 329 DEFINE_STATIC_LOCAL(const AtomicString, pragmaHeader, ("pragma", AtomicStrin
g::ConstructFromLiteral)); |
| 330 return pragmaHeader; |
| 331 } |
| 332 |
| 333 bool ResourceRequest::cacheControlContainsNoCache() |
| 334 { |
| 335 if (!m_cacheControlHeader.parsed) |
| 336 m_cacheControlHeader = parseCacheControlDirectives(m_httpHeaderFields.ge
t(cacheControlHeaderString()), m_httpHeaderFields.get(pragmaHeaderString())); |
| 337 return m_cacheControlHeader.containsNoCache; |
| 338 } |
| 339 |
| 340 bool ResourceRequest::cacheControlContainsNoStore() |
| 341 { |
| 342 if (!m_cacheControlHeader.parsed) |
| 343 m_cacheControlHeader = parseCacheControlDirectives(m_httpHeaderFields.ge
t(cacheControlHeaderString()), m_httpHeaderFields.get(pragmaHeaderString())); |
| 344 return m_cacheControlHeader.containsNoStore; |
| 345 } |
| 346 |
| 347 bool ResourceRequest::hasCacheValidatorFields() |
| 348 { |
| 349 DEFINE_STATIC_LOCAL(const AtomicString, lastModifiedHeader, ("last-modified"
, AtomicString::ConstructFromLiteral)); |
| 350 DEFINE_STATIC_LOCAL(const AtomicString, eTagHeader, ("etag", AtomicString::C
onstructFromLiteral)); |
| 351 return !m_httpHeaderFields.get(lastModifiedHeader).isEmpty() || !m_httpHeade
rFields.get(eTagHeader).isEmpty(); |
319 } | 352 } |
320 | 353 |
321 double ResourceRequest::defaultTimeoutInterval() | 354 double ResourceRequest::defaultTimeoutInterval() |
322 { | 355 { |
323 return s_defaultTimeoutInterval; | 356 return s_defaultTimeoutInterval; |
324 } | 357 } |
325 | 358 |
326 void ResourceRequest::setDefaultTimeoutInterval(double timeoutInterval) | 359 void ResourceRequest::setDefaultTimeoutInterval(double timeoutInterval) |
327 { | 360 { |
328 s_defaultTimeoutInterval = timeoutInterval; | 361 s_defaultTimeoutInterval = timeoutInterval; |
(...skipping 23 matching lines...) Expand all Loading... |
352 // This is used by the loader to control the number of issued parallel load requ
ests. | 385 // This is used by the loader to control the number of issued parallel load requ
ests. |
353 unsigned initializeMaximumHTTPConnectionCountPerHost() | 386 unsigned initializeMaximumHTTPConnectionCountPerHost() |
354 { | 387 { |
355 // The chromium network stack already handles limiting the number of | 388 // The chromium network stack already handles limiting the number of |
356 // parallel requests per host, so there's no need to do it here. Therefore, | 389 // parallel requests per host, so there's no need to do it here. Therefore, |
357 // this is set to a high value that should never be hit in practice. | 390 // this is set to a high value that should never be hit in practice. |
358 return 10000; | 391 return 10000; |
359 } | 392 } |
360 | 393 |
361 } | 394 } |
OLD | NEW |