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

Side by Side Diff: pkg/http_server/test/http_multipart_test.dart

Issue 26973004: Preserve '\' in filenames for uploads, as Windows/IE contains them. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « pkg/http_server/lib/src/http_multipart_form_data_impl.dart ('k') | sdk/lib/io/http.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:http_server/http_server.dart"; 5 import "package:http_server/http_server.dart";
6 import "package:mime/mime.dart"; 6 import "package:mime/mime.dart";
7 import "package:unittest/unittest.dart"; 7 import "package:unittest/unittest.dart";
8 import 'dart:async'; 8 import 'dart:async';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:convert'; 10 import 'dart:convert';
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 Content-Disposition: form-data; name="submit-name"\r 99 Content-Disposition: form-data; name="submit-name"\r
100 \r 100 \r
101 Larry\r 101 Larry\r
102 --AaB03x\r 102 --AaB03x\r
103 Content-Disposition: form-data; name="files"; filename="file1.txt"\r 103 Content-Disposition: form-data; name="files"; filename="file1.txt"\r
104 Content-Type: text/plain\r 104 Content-Type: text/plain\r
105 \r 105 \r
106 Content of file\r 106 Content of file\r
107 --AaB03x--\r\n'''; 107 --AaB03x--\r\n''';
108 108
109
110 postDataTest(message.codeUnits, 109 postDataTest(message.codeUnits,
111 'multipart/form-data', 110 'multipart/form-data',
112 'AaB03x', 111 'AaB03x',
113 [new FormField('submit-name', 'Larry'), 112 [new FormField('submit-name', 'Larry'),
114 new FormField('files', 113 new FormField('files',
115 'Content of file', 114 'Content of file',
116 contentType: 'text/plain', 115 contentType: 'text/plain',
117 filename: 'file1.txt')]); 116 filename: 'file1.txt')]);
117
118 // Windows/IE style file upload.
119 message = '''
120 \r\n--AaB03x\r
121 Content-Disposition: form-data; name="files"; filename="C:\\file1\\".txt"\r
122 Content-Type: text/plain\r
123 \r
124 Content of file\r
125 --AaB03x--\r\n''';
126
127
128 postDataTest(message.codeUnits,
129 'multipart/form-data',
130 'AaB03x',
131 [new FormField('files',
132 'Content of file',
133 contentType: 'text/plain',
134 filename: 'C:\\file1".txt')]);
118 // Similar test using Chrome posting. 135 // Similar test using Chrome posting.
119 message = [ 136 message = [
120 45, 45, 45, 45, 45, 45, 87, 101, 98, 75, 105, 116, 70, 111, 114, 109, 66, 137 45, 45, 45, 45, 45, 45, 87, 101, 98, 75, 105, 116, 70, 111, 114, 109, 66,
121 111, 117, 110, 100, 97, 114, 121, 81, 83, 113, 108, 56, 107, 68, 65, 76, 138 111, 117, 110, 100, 97, 114, 121, 81, 83, 113, 108, 56, 107, 68, 65, 76,
122 77, 55, 116, 65, 107, 67, 49, 13, 10, 67, 111, 110, 116, 101, 110, 116, 139 77, 55, 116, 65, 107, 67, 49, 13, 10, 67, 111, 110, 116, 101, 110, 116,
123 45, 68, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 58, 32, 102, 140 45, 68, 105, 115, 112, 111, 115, 105, 116, 105, 111, 110, 58, 32, 102,
124 111, 114, 109, 45, 100, 97, 116, 97, 59, 32, 110, 97, 109, 101, 61, 34, 141 111, 114, 109, 45, 100, 97, 116, 97, 59, 32, 110, 97, 109, 101, 61, 34,
125 115, 117, 98, 109, 105, 116, 45, 110, 97, 109, 101, 34, 13, 10, 13, 10, 142 115, 117, 98, 109, 105, 116, 45, 110, 97, 109, 101, 34, 13, 10, 13, 10,
126 84, 101, 115, 116, 13, 10, 45, 45, 45, 45, 45, 45, 87, 101, 98, 75, 105, 143 84, 101, 115, 116, 13, 10, 45, 45, 45, 45, 45, 45, 87, 101, 98, 75, 105,
127 116, 70, 111, 114, 109, 66, 111, 117, 110, 100, 97, 114, 121, 81, 83, 113, 144 116, 70, 111, 114, 109, 66, 111, 117, 110, 100, 97, 114, 121, 81, 83, 113,
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 postDataTest(message, 207 postDataTest(message,
191 'multipart/form-data', 208 'multipart/form-data',
192 '----WebKitFormBoundaryfe0EzV1aNysD1bPh', 209 '----WebKitFormBoundaryfe0EzV1aNysD1bPh',
193 [new FormField('name', 'øv')]); 210 [new FormField('name', 'øv')]);
194 } 211 }
195 212
196 213
197 void main() { 214 void main() {
198 testPostData(); 215 testPostData();
199 } 216 }
OLDNEW
« no previous file with comments | « pkg/http_server/lib/src/http_multipart_form_data_impl.dart ('k') | sdk/lib/io/http.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698