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

Side by Side Diff: Source/core/loader/FrameFetchContext.cpp

Issue 352313003: Make it possible to set the HTTP origin header from content (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 6 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
« no previous file with comments | « Source/core/loader/FormSubmission.cpp ('k') | Source/core/loader/FrameLoader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 outgoingReferrer = request.httpReferrer(); 68 outgoingReferrer = request.httpReferrer();
69 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)- >toString(); 69 outgoingOrigin = SecurityOrigin::createFromString(outgoingReferrer)- >toString();
70 } 70 }
71 71
72 outgoingReferrer = SecurityPolicy::generateReferrerHeader(document->refe rrerPolicy(), request.url(), outgoingReferrer); 72 outgoingReferrer = SecurityPolicy::generateReferrerHeader(document->refe rrerPolicy(), request.url(), outgoingReferrer);
73 if (outgoingReferrer.isEmpty()) 73 if (outgoingReferrer.isEmpty())
74 request.clearHTTPReferrer(); 74 request.clearHTTPReferrer();
75 else if (!request.httpReferrer()) 75 else if (!request.httpReferrer())
76 request.setHTTPReferrer(Referrer(outgoingReferrer, document->referre rPolicy())); 76 request.setHTTPReferrer(Referrer(outgoingReferrer, document->referre rPolicy()));
77 77
78 FrameLoader::addHTTPOriginIfNeeded(request, AtomicString(outgoingOrigin) ); 78 request.addHTTPOriginIfNeeded(AtomicString(outgoingOrigin));
79 } 79 }
80 80
81 // The remaining modifications are only necessary for HTTP and HTTPS. 81 // The remaining modifications are only necessary for HTTP and HTTPS.
82 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily()) 82 if (!request.url().isEmpty() && !request.url().protocolIsInHTTPFamily())
83 return; 83 return;
84 84
85 m_frame->loader().applyUserAgent(request); 85 m_frame->loader().applyUserAgent(request);
86 86
87 // Default to sending an empty Origin header if one hasn't been set yet. 87 // Default to sending an empty Origin header if one hasn't been set yet.
88 FrameLoader::addHTTPOriginIfNeeded(request, nullAtom); 88 request.addHTTPOriginIfNeeded(nullAtom);
89 } 89 }
90 90
91 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request) 91 void FrameFetchContext::setFirstPartyForCookies(ResourceRequest& request)
92 { 92 {
93 if (m_frame->tree().top()->isLocalFrame()) 93 if (m_frame->tree().top()->isLocalFrame())
94 request.setFirstPartyForCookies(toLocalFrame(m_frame->tree().top())->doc ument()->firstPartyForCookies()); 94 request.setFirstPartyForCookies(toLocalFrame(m_frame->tree().top())->doc ument()->firstPartyForCookies());
95 } 95 }
96 96
97 CachePolicy FrameFetchContext::cachePolicy(Document* document) const 97 CachePolicy FrameFetchContext::cachePolicy(Document* document) const
98 { 98 {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 if (!response.isNull()) 197 if (!response.isNull())
198 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response); 198 dispatchDidReceiveResponse(ensureLoader(loader), identifier, response);
199 199
200 if (dataLength > 0) 200 if (dataLength > 0)
201 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength, 0); 201 dispatchDidReceiveData(ensureLoader(loader), identifier, 0, dataLength, 0);
202 202
203 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0); 203 dispatchDidFinishLoading(ensureLoader(loader), identifier, 0, 0);
204 } 204 }
205 205
206 } // namespace WebCore 206 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/loader/FormSubmission.cpp ('k') | Source/core/loader/FrameLoader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698