| OLD | NEW |
| 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 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 | 9 |
| 10 import 'dart:convert' show | 10 import 'dart:convert' show |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 response.headers.set("X-WebKit-CSP", content_header_value); | 359 response.headers.set("X-WebKit-CSP", content_header_value); |
| 360 } | 360 } |
| 361 } | 361 } |
| 362 if (path.filename.endsWith('.html')) { | 362 if (path.filename.endsWith('.html')) { |
| 363 response.headers.set('Content-Type', 'text/html'); | 363 response.headers.set('Content-Type', 'text/html'); |
| 364 } else if (path.filename.endsWith('.js')) { | 364 } else if (path.filename.endsWith('.js')) { |
| 365 response.headers.set('Content-Type', 'application/javascript'); | 365 response.headers.set('Content-Type', 'application/javascript'); |
| 366 } else if (path.filename.endsWith('.dart')) { | 366 } else if (path.filename.endsWith('.dart')) { |
| 367 response.headers.set('Content-Type', 'application/dart'); | 367 response.headers.set('Content-Type', 'application/dart'); |
| 368 } | 368 } |
| 369 response.headers.removeAll("X-Frame-Options"); |
| 369 file.openRead().pipe(response).catchError((e) { | 370 file.openRead().pipe(response).catchError((e) { |
| 370 DebugLogger.warning( | 371 DebugLogger.warning( |
| 371 'HttpServer: error while closing the response stream', e); | 372 'HttpServer: error while closing the response stream', e); |
| 372 }); | 373 }); |
| 373 } | 374 } |
| 374 | 375 |
| 375 void _sendNotFound(HttpRequest request, HttpResponse response) { | 376 void _sendNotFound(HttpRequest request, HttpResponse response) { |
| 376 bool isHarmlessPath(String path) { | 377 bool isHarmlessPath(String path) { |
| 377 return _HARMLESS_REQUEST_PATH_ENDINGS.any((ending) { | 378 return _HARMLESS_REQUEST_PATH_ENDINGS.any((ending) { |
| 378 return path.endsWith(ending); | 379 return path.endsWith(ending); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 class _Entry implements Comparable { | 416 class _Entry implements Comparable { |
| 416 final String name; | 417 final String name; |
| 417 final String displayName; | 418 final String displayName; |
| 418 | 419 |
| 419 _Entry(this.name, this.displayName); | 420 _Entry(this.name, this.displayName); |
| 420 | 421 |
| 421 int compareTo(_Entry other) { | 422 int compareTo(_Entry other) { |
| 422 return name.compareTo(other.name); | 423 return name.compareTo(other.name); |
| 423 } | 424 } |
| 424 } | 425 } |
| OLD | NEW |