Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(383)

Side by Side Diff: Source/web/AssociatedURLLoader.cpp

Issue 1018903002: Show deprecation warnings for header values in XHR according to RFC 7230 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "web/AssociatedURLLoader.h" 32 #include "web/AssociatedURLLoader.h"
33 33
34 #include "core/fetch/CrossOriginAccessControl.h" 34 #include "core/fetch/CrossOriginAccessControl.h"
35 #include "core/fetch/FetchUtils.h" 35 #include "core/fetch/FetchUtils.h"
36 #include "core/frame/UseCounter.h"
36 #include "core/loader/DocumentThreadableLoader.h" 37 #include "core/loader/DocumentThreadableLoader.h"
37 #include "core/loader/DocumentThreadableLoaderClient.h" 38 #include "core/loader/DocumentThreadableLoaderClient.h"
38 #include "platform/Timer.h" 39 #include "platform/Timer.h"
39 #include "platform/exported/WrappedResourceRequest.h" 40 #include "platform/exported/WrappedResourceRequest.h"
40 #include "platform/exported/WrappedResourceResponse.h" 41 #include "platform/exported/WrappedResourceResponse.h"
41 #include "platform/network/HTTPParsers.h" 42 #include "platform/network/HTTPParsers.h"
42 #include "platform/network/ResourceError.h" 43 #include "platform/network/ResourceError.h"
43 #include "public/platform/WebHTTPHeaderVisitor.h" 44 #include "public/platform/WebHTTPHeaderVisitor.h"
44 #include "public/platform/WebString.h" 45 #include "public/platform/WebString.h"
45 #include "public/platform/WebURLError.h" 46 #include "public/platform/WebURLError.h"
(...skipping 16 matching lines...) Expand all
62 63
63 void visitHeader(const WebString& name, const WebString& value); 64 void visitHeader(const WebString& name, const WebString& value);
64 bool isSafe() const { return m_isSafe; } 65 bool isSafe() const { return m_isSafe; }
65 66
66 private: 67 private:
67 bool m_isSafe; 68 bool m_isSafe;
68 }; 69 };
69 70
70 void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebStr ing& value) 71 void HTTPRequestHeaderValidator::visitHeader(const WebString& name, const WebStr ing& value)
71 { 72 {
73 // Show deprecation warnings and count occurrences of such deprecated header values
74 if (isValidHTTPHeaderValueForFetch(value))
75 UseCounter::deprecationMessage(UseCounter::FetchHeaderValue);
hiroshige 2015/08/27 11:38:08 I think deprecation message here is not needed (or
shiva.jm 2015/09/01 08:26:51 Done.
76
72 m_isSafe = m_isSafe && isValidHTTPToken(name) && !FetchUtils::isForbiddenHea derName(name) && isValidHTTPHeaderValue(value); 77 m_isSafe = m_isSafe && isValidHTTPToken(name) && !FetchUtils::isForbiddenHea derName(name) && isValidHTTPHeaderValue(value);
73 } 78 }
74 79
75 // FIXME: Remove this and use WebCore code that does the same thing. 80 // FIXME: Remove this and use WebCore code that does the same thing.
76 class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor { 81 class HTTPResponseHeaderValidator : public WebHTTPHeaderVisitor {
77 WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator); 82 WTF_MAKE_NONCOPYABLE(HTTPResponseHeaderValidator);
78 public: 83 public:
79 HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl( usingAccessControl) { } 84 HTTPResponseHeaderValidator(bool usingAccessControl) : m_usingAccessControl( usingAccessControl) { }
80 85
81 void visitHeader(const WebString& name, const WebString& value); 86 void visitHeader(const WebString& name, const WebString& value);
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
377 m_loader->cancel(); 382 m_loader->cancel();
378 } 383 }
379 384
380 void AssociatedURLLoader::setDefersLoading(bool defersLoading) 385 void AssociatedURLLoader::setDefersLoading(bool defersLoading)
381 { 386 {
382 if (m_loader) 387 if (m_loader)
383 m_loader->setDefersLoading(defersLoading); 388 m_loader->setDefersLoading(defersLoading);
384 } 389 }
385 390
386 } // namespace blink 391 } // namespace blink
OLDNEW
« Source/platform/network/HTTPParsers.cpp ('K') | « Source/platform/network/HTTPParsers.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698