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

Side by Side Diff: LayoutTests/http/tests/fetch/resources/fetch-test-helpers.js

Issue 1288263003: Normalize and update the header value checks to RFC 7230 for Fetch 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 if (self.importScripts) { 1 if (self.importScripts) {
2 importScripts('/resources/testharness.js'); 2 importScripts('/resources/testharness.js');
3 importScripts('/resources/testharness-helpers.js'); 3 importScripts('/resources/testharness-helpers.js');
4 importScripts('/serviceworker/resources/test-helpers.js'); 4 importScripts('/serviceworker/resources/test-helpers.js');
5 importScripts('/fetch/resources/fetch-test-options.js'); 5 importScripts('/fetch/resources/fetch-test-options.js');
6 } 6 }
7 7
8 function getContentType(headers) { 8 function getContentType(headers) {
9 var content_type = ''; 9 var content_type = '';
10 for (var header of headers) { 10 for (var header of headers) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // - "Content-Type" (CONTENT_TYPE): This can be 72 // - "Content-Type" (CONTENT_TYPE): This can be
73 // a simple header if the header value is in SIMPLE_HEADER_CONTENT_TYPE_VALUES 73 // a simple header if the header value is in SIMPLE_HEADER_CONTENT_TYPE_VALUES
74 // or not if the header value is in NON_SIMPLE_HEADER_CONTENT_TYPE_VALUES. 74 // or not if the header value is in NON_SIMPLE_HEADER_CONTENT_TYPE_VALUES.
75 // - others (NON_SIMPLE_HEADER_NAMES) 75 // - others (NON_SIMPLE_HEADER_NAMES)
76 76
77 // A header name must match token in RFC 2616. 77 // A header name must match token in RFC 2616.
78 // Fetch API Spec: https://fetch.spec.whatwg.org/#concept-header-name 78 // Fetch API Spec: https://fetch.spec.whatwg.org/#concept-header-name
79 var INVALID_HEADER_NAMES = INVALID_TOKENS; 79 var INVALID_HEADER_NAMES = INVALID_TOKENS;
80 var INVALID_HEADER_VALUES = [ 80 var INVALID_HEADER_VALUES = [
81 'test \r data', 'test \n data', 'test \0 data', 81 'test \r data', 'test \n data', 'test \0 data',
82 'test\r\n data', 82 'test\r\n data', 'test\0', '', ' ', '\x7f', 't\bt', 't\vt',
hiroshige 2015/09/09 07:01:48 '', ' ', and '\r\n'.repeat(50000) will be valid.
shiva.jm 2015/09/10 10:10:26 Done.
83 'test\r', 'test\n', 'test\r\n', 'test\0', 83 '\0'.repeat(100000), '\r\n'.repeat(50000),
84 '\0'.repeat(100000), '\r\n'.repeat(50000), 'x'.repeat(100000) + '\0']; 84 '\u3042', 'x'.repeat(100000) + '\0'];
85 85
86 var FORBIDDEN_HEADER_NAMES = 86 var FORBIDDEN_HEADER_NAMES =
87 ['Accept-Charset', 'Accept-Encoding', 'Access-Control-Request-Headers', 87 ['Accept-Charset', 'Accept-Encoding', 'Access-Control-Request-Headers',
88 'Access-Control-Request-Method', 'Connection', 'Content-Length', 88 'Access-Control-Request-Method', 'Connection', 'Content-Length',
89 'Cookie', 'Cookie2', 'Date', 'DNT', 'Expect', 'Host', 'Keep-Alive', 89 'Cookie', 'Cookie2', 'Date', 'DNT', 'Expect', 'Host', 'Keep-Alive',
90 'Origin', 'Referer', 'TE', 'Trailer', 'Transfer-Encoding', 'Upgrade', 90 'Origin', 'Referer', 'TE', 'Trailer', 'Transfer-Encoding', 'Upgrade',
91 'User-Agent', 'Via', 'Proxy-', 'Sec-', 'Proxy-FooBar', 'Sec-FooBar']; 91 'User-Agent', 'Via', 'Proxy-', 'Sec-', 'Proxy-FooBar', 'Sec-FooBar'];
92 var FORBIDDEN_RESPONSE_HEADER_NAMES = 92 var FORBIDDEN_RESPONSE_HEADER_NAMES =
93 ['Set-Cookie', 'Set-Cookie2', 93 ['Set-Cookie', 'Set-Cookie2',
94 'set-cookie', 'set-cookie2', 94 'set-cookie', 'set-cookie2',
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 function() { 209 function() {
210 if (mode !== 'same-origin') { 210 if (mode !== 'same-origin') {
211 assert_unreached( 211 assert_unreached(
212 'Test 5: Cross-origin HTTPS request must success: ' + 212 'Test 5: Cross-origin HTTPS request must success: ' +
213 'mode = ' + mode); 213 'mode = ' + mode);
214 } 214 }
215 }); 215 });
216 }); 216 });
217 }, 'Block fetch() as mixed content (' + mode + ')'); 217 }, 'Block fetch() as mixed content (' + mode + ')');
218 } 218 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698