| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, 2011, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2010, 2011, 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 void visitHeader(const WebString& name, const WebString& value); | 65 void visitHeader(const WebString& name, const WebString& value); |
| 66 bool isSafe() const { return m_isSafe; } | 66 bool isSafe() const { return m_isSafe; } |
| 67 | 67 |
| 68 private: | 68 private: |
| 69 bool m_isSafe; | 69 bool m_isSafe; |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebStr
ing& value) | 72 void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebStr
ing& value) |
| 73 { | 73 { |
| 74 m_isSafe = m_isSafe && isValidHTTPToken(name) && XMLHttpRequest::isAllowedHT
TPHeader(name) && isValidHTTPHeaderValue(value); | 74 m_isSafe = m_isSafe && isValidHTTPToken(name) && !CrossOriginAccessControl::
isForbiddenHeaderName(name) && isValidHTTPHeaderValue(value); |
| 75 } | 75 } |
| 76 | 76 |
| 77 // FIXME: Remove this and use WebCore code that does the same thing. | 77 // FIXME: Remove this and use WebCore code that does the same thing. |
| 78 class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { | 78 class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { |
| 79 WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); | 79 WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); |
| 80 public: | 80 public: |
| 81 HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl(
usingAccessControl) { } | 81 HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl(
usingAccessControl) { } |
| 82 | 82 |
| 83 void visitHeader(const WebString& name, const WebString& value); | 83 void visitHeader(const WebString& name, const WebString& value); |
| 84 const HTTPHeaderSet& blockedHeaders(); | 84 const HTTPHeaderSet& blockedHeaders(); |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 { | 319 { |
| 320 ASSERT(!m_client); | 320 ASSERT(!m_client); |
| 321 | 321 |
| 322 m_client = client; | 322 m_client = client; |
| 323 ASSERT(m_client); | 323 ASSERT(m_client); |
| 324 | 324 |
| 325 bool allowLoad = true; | 325 bool allowLoad = true; |
| 326 WebURLRequest newRequest(request); | 326 WebURLRequest newRequest(request); |
| 327 if (m_options.untrustedHTTP) { | 327 if (m_options.untrustedHTTP) { |
| 328 WebString method = newRequest.httpMethod(); | 328 WebString method = newRequest.httpMethod(); |
| 329 allowLoad = isValidHTTPToken(method) && XMLHttpRequest::isAllowedHTTPMet
hod(method); | 329 allowLoad = isValidHTTPToken(method) && CrossOriginAccessControl::isUsef
ulMethod(method); |
| 330 if (allowLoad) { | 330 if (allowLoad) { |
| 331 newRequest.setHTTPMethod(XMLHttpRequest::uppercaseKnownHTTPMethod(me
thod)); | 331 newRequest.setHTTPMethod(XMLHttpRequest::uppercaseKnownHTTPMethod(me
thod)); |
| 332 HTTPRequestHeaderValidator validator; | 332 HTTPRequestHeaderValidator validator; |
| 333 newRequest.visitHTTPHeaderFields(&validator); | 333 newRequest.visitHTTPHeaderFields(&validator); |
| 334 allowLoad = validator.isSafe(); | 334 allowLoad = validator.isSafe(); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 | 337 |
| 338 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); | 338 m_clientAdapter = ClientAdapter::create(this, m_client, m_options); |
| 339 | 339 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 m_loader->cancel(); | 373 m_loader->cancel(); |
| 374 } | 374 } |
| 375 | 375 |
| 376 void AssociatedURLLoader::setDefersLoading(bool defersLoading) | 376 void AssociatedURLLoader::setDefersLoading(bool defersLoading) |
| 377 { | 377 { |
| 378 if (m_loader) | 378 if (m_loader) |
| 379 m_loader->setDefersLoading(defersLoading); | 379 m_loader->setDefersLoading(defersLoading); |
| 380 } | 380 } |
| 381 | 381 |
| 382 } // namespace blink | 382 } // namespace blink |
| OLD | NEW |