| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 "X-Content-Security-Policy"]) { | 390 "X-Content-Security-Policy"]) { |
| 391 response.headers.set(header, content_header_value); | 391 response.headers.set(header, content_header_value); |
| 392 } | 392 } |
| 393 if (const ["safari"].contains(runtime)) { | 393 if (const ["safari"].contains(runtime)) { |
| 394 response.headers.set("X-WebKit-CSP", content_header_value); | 394 response.headers.set("X-WebKit-CSP", content_header_value); |
| 395 } | 395 } |
| 396 } | 396 } |
| 397 if (path.filename.endsWith('.html')) { | 397 if (path.filename.endsWith('.html')) { |
| 398 response.headers.set('Content-Type', 'text/html'); | 398 response.headers.set('Content-Type', 'text/html'); |
| 399 } else if (path.filename.endsWith('.js')) { | 399 } else if (path.filename.endsWith('.js')) { |
| 400 response.headers.set('Content-Type', 'application/javascript'); | 400 response.headers.set('Content-Type', |
| 401 'application/javascript;charset=UTF-8'); |
| 401 } else if (path.filename.endsWith('.dart')) { | 402 } else if (path.filename.endsWith('.dart')) { |
| 402 response.headers.set('Content-Type', 'application/dart'); | 403 response.headers.set('Content-Type', 'application/dart'); |
| 403 } else if (path.filename.endsWith('.css')) { | 404 } else if (path.filename.endsWith('.css')) { |
| 404 response.headers.set('Content-Type', 'text/css'); | 405 response.headers.set('Content-Type', 'text/css'); |
| 405 } else if (path.filename.endsWith('.xml')) { | 406 } else if (path.filename.endsWith('.xml')) { |
| 406 response.headers.set('Content-Type', 'text/xml'); | 407 response.headers.set('Content-Type', 'text/xml'); |
| 407 } | 408 } |
| 408 response.headers.removeAll("X-Frame-Options"); | 409 response.headers.removeAll("X-Frame-Options"); |
| 409 file.openRead().pipe(response).catchError((e) { | 410 file.openRead().pipe(response).catchError((e) { |
| 410 DebugLogger.warning( | 411 DebugLogger.warning( |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 class _Entry implements Comparable { | 457 class _Entry implements Comparable { |
| 457 final String name; | 458 final String name; |
| 458 final String displayName; | 459 final String displayName; |
| 459 | 460 |
| 460 _Entry(this.name, this.displayName); | 461 _Entry(this.name, this.displayName); |
| 461 | 462 |
| 462 int compareTo(_Entry other) { | 463 int compareTo(_Entry other) { |
| 463 return name.compareTo(other.name); | 464 return name.compareTo(other.name); |
| 464 } | 465 } |
| 465 } | 466 } |
| OLD | NEW |