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

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', 't\bt', 't\vt',
83 'test\r', 'test\n', 'test\r\n', 'test\0', 83 '\x01', '\x02', '\x03', '\x04', '\x05', '\x06', '\x07', '\x08',
84 '\0'.repeat(100000), '\r\n'.repeat(50000), 'x'.repeat(100000) + '\0']; 84 '\x0b', '\x0c', '\x0e', '\x0f',
85 '\x10', '\x11', '\x12', '\x13', '\x14', '\x15', '\x16', '\x17',
86 '\x18', '\x19', '\x1a', '\x1b', '\x1c', '\x1d', '\x1e', '\x1f', '\x7f',
87 '\0'.repeat(100000), '\u3042', 'x'.repeat(100000) + '\0'];
85 88
86 var FORBIDDEN_HEADER_NAMES = 89 var FORBIDDEN_HEADER_NAMES =
87 ['Accept-Charset', 'Accept-Encoding', 'Access-Control-Request-Headers', 90 ['Accept-Charset', 'Accept-Encoding', 'Access-Control-Request-Headers',
88 'Access-Control-Request-Method', 'Connection', 'Content-Length', 91 'Access-Control-Request-Method', 'Connection', 'Content-Length',
89 'Cookie', 'Cookie2', 'Date', 'DNT', 'Expect', 'Host', 'Keep-Alive', 92 'Cookie', 'Cookie2', 'Date', 'DNT', 'Expect', 'Host', 'Keep-Alive',
90 'Origin', 'Referer', 'TE', 'Trailer', 'Transfer-Encoding', 'Upgrade', 93 'Origin', 'Referer', 'TE', 'Trailer', 'Transfer-Encoding', 'Upgrade',
91 'User-Agent', 'Via', 'Proxy-', 'Sec-', 'Proxy-FooBar', 'Sec-FooBar']; 94 'User-Agent', 'Via', 'Proxy-', 'Sec-', 'Proxy-FooBar', 'Sec-FooBar'];
92 var FORBIDDEN_RESPONSE_HEADER_NAMES = 95 var FORBIDDEN_RESPONSE_HEADER_NAMES =
93 ['Set-Cookie', 'Set-Cookie2', 96 ['Set-Cookie', 'Set-Cookie2',
94 'set-cookie', 'set-cookie2', 97 'set-cookie', 'set-cookie2',
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 function() { 212 function() {
210 if (mode !== 'same-origin') { 213 if (mode !== 'same-origin') {
211 assert_unreached( 214 assert_unreached(
212 'Test 5: Cross-origin HTTPS request must success: ' + 215 'Test 5: Cross-origin HTTPS request must success: ' +
213 'mode = ' + mode); 216 'mode = ' + mode);
214 } 217 }
215 }); 218 });
216 }); 219 });
217 }, 'Block fetch() as mixed content (' + mode + ')'); 220 }, 'Block fetch() as mixed content (' + mode + ')');
218 } 221 }
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/fetch/script-tests/headers.js » ('j') | Source/modules/fetch/Headers.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698