| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 } | 394 } |
| 395 } | 395 } |
| 396 if (path.filename.endsWith('.html')) { | 396 if (path.filename.endsWith('.html')) { |
| 397 response.headers.set('Content-Type', 'text/html'); | 397 response.headers.set('Content-Type', 'text/html'); |
| 398 } else if (path.filename.endsWith('.js')) { | 398 } else if (path.filename.endsWith('.js')) { |
| 399 response.headers.set('Content-Type', 'application/javascript'); | 399 response.headers.set('Content-Type', 'application/javascript'); |
| 400 } else if (path.filename.endsWith('.dart')) { | 400 } else if (path.filename.endsWith('.dart')) { |
| 401 response.headers.set('Content-Type', 'application/dart'); | 401 response.headers.set('Content-Type', 'application/dart'); |
| 402 } else if (path.filename.endsWith('.css')) { | 402 } else if (path.filename.endsWith('.css')) { |
| 403 response.headers.set('Content-Type', 'text/css'); | 403 response.headers.set('Content-Type', 'text/css'); |
| 404 } else if (path.filename.endsWith('.xml')) { |
| 405 response.headers.set('Content-Type', 'text/xml'); |
| 404 } | 406 } |
| 405 response.headers.removeAll("X-Frame-Options"); | 407 response.headers.removeAll("X-Frame-Options"); |
| 406 file.openRead().pipe(response).catchError((e) { | 408 file.openRead().pipe(response).catchError((e) { |
| 407 DebugLogger.warning( | 409 DebugLogger.warning( |
| 408 'HttpServer: error while closing the response stream', e); | 410 'HttpServer: error while closing the response stream', e); |
| 409 }); | 411 }); |
| 410 } | 412 } |
| 411 | 413 |
| 412 void _sendNotFound(HttpRequest request) { | 414 void _sendNotFound(HttpRequest request) { |
| 413 bool isHarmlessPath(String path) { | 415 bool isHarmlessPath(String path) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 class _Entry implements Comparable { | 455 class _Entry implements Comparable { |
| 454 final String name; | 456 final String name; |
| 455 final String displayName; | 457 final String displayName; |
| 456 | 458 |
| 457 _Entry(this.name, this.displayName); | 459 _Entry(this.name, this.displayName); |
| 458 | 460 |
| 459 int compareTo(_Entry other) { | 461 int compareTo(_Entry other) { |
| 460 return name.compareTo(other.name); | 462 return name.compareTo(other.name); |
| 461 } | 463 } |
| 462 } | 464 } |
| OLD | NEW |