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

Side by Side Diff: tools/testing/dart/http_server.dart

Issue 12625006: Fixing IE10 CORS test. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | « tests/html/xhr_cross_origin_test.dart ('k') | no next file » | 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 library http_server; 5 library http_server;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:io'; 8 import 'dart:io';
9 import 'dart:isolate'; 9 import 'dart:isolate';
10 import 'dart:uri'; 10 import 'dart:uri';
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 response.outputStream.writeString(footer); 261 response.outputStream.writeString(footer);
262 response.outputStream.close(); 262 response.outputStream.close();
263 } 263 }
264 264
265 void _sendFileContent(HttpRequest request, 265 void _sendFileContent(HttpRequest request,
266 HttpResponse response, 266 HttpResponse response,
267 int allowedPort, 267 int allowedPort,
268 Path path, 268 Path path,
269 File file) { 269 File file) {
270 if (allowedPort != -1) { 270 if (allowedPort != -1) {
271 var origin = new Uri(request.headers.value('Origin')); 271 var headerOrigin = request.headers.value('Origin');
272 // Allow loading from http://*:$allowedPort in browsers. 272 var allowedOrigin;
273 var allowedOrigin = 273 if (headerOrigin != null) {
274 var origin = new Uri(headerOrigin);
275 // Allow loading from http://*:$allowedPort in browsers.
276 allowedOrigin =
274 '${origin.scheme}://${origin.domain}:${allowedPort}'; 277 '${origin.scheme}://${origin.domain}:${allowedPort}';
278 } else {
279 // IE10 appears to be bugged and is not sending the Origin header
280 // when making CORS requests to the same domain but different port.
281 allowedOrigin = '*';
kustermann 2013/03/16 22:41:19 I think this is not the right approach: You know
282 }
283
284
275 response.headers.set("Access-Control-Allow-Origin", allowedOrigin); 285 response.headers.set("Access-Control-Allow-Origin", allowedOrigin);
276 response.headers.set('Access-Control-Allow-Credentials', 'true'); 286 response.headers.set('Access-Control-Allow-Credentials', 'true');
277 } else { 287 } else {
278 // No allowedPort specified. Allow from anywhere (but cross-origin 288 // No allowedPort specified. Allow from anywhere (but cross-origin
279 // requests *with credentials* will fail because you can't use "*"). 289 // requests *with credentials* will fail because you can't use "*").
280 response.headers.set("Access-Control-Allow-Origin", "*"); 290 response.headers.set("Access-Control-Allow-Origin", "*");
281 } 291 }
282 if (useContentSecurityPolicy) { 292 if (useContentSecurityPolicy) {
283 // Chrome respects the standardized Content-Security-Policy header, 293 // Chrome respects the standardized Content-Security-Policy header,
284 // whereas Firefox and IE10 use X-Content-Security-Policy. Safari 294 // whereas Firefox and IE10 use X-Content-Security-Policy. Safari
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 class _Entry { 333 class _Entry {
324 final String name; 334 final String name;
325 final String displayName; 335 final String displayName;
326 336
327 _Entry(this.name, this.displayName); 337 _Entry(this.name, this.displayName);
328 338
329 int compareTo(_Entry other) { 339 int compareTo(_Entry other) {
330 return name.compareTo(other.name); 340 return name.compareTo(other.name);
331 } 341 }
332 } 342 }
OLDNEW
« no previous file with comments | « tests/html/xhr_cross_origin_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698