| 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 part of http_server; | 5 library http_server.virtual_directory; |
| 6 | 6 |
| 7 import 'dart:async'; |
| 8 import 'dart:convert'; |
| 9 import 'dart:io'; |
| 10 |
| 11 import 'package:mime/mime.dart'; |
| 12 import 'package:path/path.dart'; |
| 7 | 13 |
| 8 // Used for signal a directory redirecting, where a tailing slash is missing. | 14 // Used for signal a directory redirecting, where a tailing slash is missing. |
| 9 class _DirectoryRedirect { | 15 class _DirectoryRedirect { |
| 10 const _DirectoryRedirect(); | 16 const _DirectoryRedirect(); |
| 11 } | 17 } |
| 12 | 18 |
| 13 typedef dynamic _DirCallback(Directory dir, HttpRequest request); | 19 typedef dynamic _DirCallback(Directory dir, HttpRequest request); |
| 14 typedef dynamic _ErrorCallback(HttpRequest request); | 20 typedef dynamic _ErrorCallback(HttpRequest request); |
| 15 | 21 |
| 16 /** | 22 /** |
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 | 469 |
| 464 Future close() => new Future.value(); | 470 Future close() => new Future.value(); |
| 465 | 471 |
| 466 void setMimeType(List<int> bytes) { | 472 void setMimeType(List<int> bytes) { |
| 467 var mimeType = lookupMimeType(path, headerBytes: bytes); | 473 var mimeType = lookupMimeType(path, headerBytes: bytes); |
| 468 if (mimeType != null) { | 474 if (mimeType != null) { |
| 469 response.headers.contentType = ContentType.parse(mimeType); | 475 response.headers.contentType = ContentType.parse(mimeType); |
| 470 } | 476 } |
| 471 } | 477 } |
| 472 } | 478 } |
| OLD | NEW |