diff --git a/pkg/http_server/CHANGELOG.md b/pkg/http_server/CHANGELOG.md index 2cef10944ee..d13aea8ae77 100644 --- a/pkg/http_server/CHANGELOG.md +++ b/pkg/http_server/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.9.5+1 + +* Updated the layout of package contents. + # 0.9.5 * Removed the decoding of HTML entity values (in the form &#xxxxx;) for diff --git a/pkg/http_server/README.md b/pkg/http_server/README.md index f0b90f4588a..e428814ae3c 100644 --- a/pkg/http_server/README.md +++ b/pkg/http_server/README.md @@ -1,19 +1,12 @@ -# http_server +A set of high-level classes that, together with +`HttpServer`, makes is easier to serve web content. -This package contains a set of high-level classes that, together with -HttpServer, makes is easy to provide content through HTTP servers. - -**NOTE:** This package currently only works for -server-side or command-line Dart applications. In other words, if the app -imports `dart:io`, it can use this package. - -## Using - -Please see the [API docs][docs] for explanations and examples. +**NOTE:** This package only works for server-side or command-line Dart +applications. In other words, if the app imports `dart:io`, it can use this +package. ## Filing issues -Please file issues for the http package at [http://dartbug.com/new][bugs]. +File issues for the `http_server` package at [http://dartbug.com/new][bugs]. [bugs]: http://dartbug.com/new -[docs]: https://api.dartlang.org/docs/channels/stable/latest/http_server.html \ No newline at end of file diff --git a/pkg/http_server/lib/http_server.dart b/pkg/http_server/lib/http_server.dart index afaf71c383b..bcd99dfd81d 100644 --- a/pkg/http_server/lib/http_server.dart +++ b/pkg/http_server/lib/http_server.dart @@ -26,11 +26,11 @@ * import 'dart:io'; * import 'dart:async'; * import 'package:http_server/http_server.dart'; - * + * * void main() { * var staticFiles = new VirtualDirectory('.') * ..allowDirectoryListing = true; - * + * * runZoned(() { * HttpServer.bind('0.0.0.0', 7777).then((server) { * print('Server running'); @@ -41,25 +41,25 @@ * } * * ## Virtual directory - * + * * The [VirtualDirectory] class makes it easy to serve static content * from the file system. It supports: - * + * * * Range-based requests. * * If-Modified-Since based caching. * * Automatic GZip-compression of content. * * Following symlinks, either throughout the system or inside * a jailed root. * * Directory listing. - * + * * See [VirtualDirectory] for more information. - * + * * ## Virtual host - * + * * The [VirtualHost] class helps to serve multiple hosts on the same * address, by using the `Host` field of the incoming requests. It also * works with wildcards for sub-domains. - * + * * var virtualHost = new VirtualHost(server); * // Filter out on a specific host * var stream1 = virtualServer.addHost('static.myserver.com'); @@ -67,24 +67,14 @@ * var stream2 = virtualServer.addHost('*.myserver.com'); * // Requets not matching any hosts. * var stream3 = virtualServer.unhandled; - * + * * See [VirtualHost] for more information. * * [pub]: http://pub.dartlang.org/packages/http_server */ library http_server; -import 'dart:async'; -import 'dart:convert'; -import 'dart:io'; - -import 'package:mime/mime.dart'; -import "package:path/path.dart"; - -part 'src/http_body.dart'; -part 'src/http_body_impl.dart'; -part 'src/http_multipart_form_data.dart'; -part 'src/http_multipart_form_data_impl.dart'; -part 'src/virtual_directory.dart'; -part 'src/virtual_host.dart'; - +export 'src/http_body.dart'; +export 'src/http_multipart_form_data.dart'; +export 'src/virtual_directory.dart'; +export 'src/virtual_host.dart'; diff --git a/pkg/http_server/lib/src/http_body.dart b/pkg/http_server/lib/src/http_body.dart index 6eb4d3174c7..c40d2843262 100644 --- a/pkg/http_server/lib/src/http_body.dart +++ b/pkg/http_server/lib/src/http_body.dart @@ -2,8 +2,13 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.http_body; +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'http_body_impl.dart'; /** * [HttpBodyHandler] is a helper class for processing and collecting @@ -104,7 +109,7 @@ class HttpBodyHandler * for more information on `multipart/form-data`. */ HttpBodyHandler({Encoding defaultEncoding: UTF8}) - : _transformer = new _HttpBodyHandlerTransformer(defaultEncoding); + : _transformer = new HttpBodyHandlerTransformer(defaultEncoding); /** * Process and parse an incoming [HttpRequest]. The returned [HttpRequestBody] @@ -115,7 +120,7 @@ class HttpBodyHandler static Future processRequest( HttpRequest request, {Encoding defaultEncoding: UTF8}) { - return _HttpBodyHandler.processRequest(request, defaultEncoding); + return HttpBodyHandlerImpl.processRequest(request, defaultEncoding); } /** @@ -126,7 +131,7 @@ class HttpBodyHandler static Future processResponse( HttpClientResponse response, {Encoding defaultEncoding: UTF8}) { - return _HttpBodyHandler.processResponse(response, defaultEncoding); + return HttpBodyHandlerImpl.processResponse(response, defaultEncoding); } Stream bind(Stream stream) { diff --git a/pkg/http_server/lib/src/http_body_impl.dart b/pkg/http_server/lib/src/http_body_impl.dart index 76829029850..b6c43c9727a 100644 --- a/pkg/http_server/lib/src/http_body_impl.dart +++ b/pkg/http_server/lib/src/http_body_impl.dart @@ -2,13 +2,22 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.http_body_impl; -class _HttpBodyHandlerTransformer +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:mime/mime.dart'; + +import 'http_body.dart'; +import 'http_multipart_form_data.dart'; + +class HttpBodyHandlerTransformer implements StreamTransformer { final Encoding _defaultEncoding; - const _HttpBodyHandlerTransformer(this._defaultEncoding); + const HttpBodyHandlerTransformer(this._defaultEncoding); Stream bind(Stream stream) { return new Stream.eventTransformed( @@ -28,7 +37,7 @@ class _HttpBodyHandlerTransformerSink implements EventSink { void add(HttpRequest request) { _pending++; - _HttpBodyHandler.processRequest(request, _defaultEncoding) + HttpBodyHandlerImpl.processRequest(request, _defaultEncoding) .then(_outSink.add, onError: _outSink.addError) .whenComplete(() { _pending--; @@ -44,7 +53,7 @@ class _HttpBodyHandlerTransformerSink implements EventSink { } } -class _HttpBodyHandler { +class HttpBodyHandlerImpl { static Future processRequest( HttpRequest request, Encoding defaultEncoding) { diff --git a/pkg/http_server/lib/src/http_multi_server.dart b/pkg/http_server/lib/src/http_multi_server.dart deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/pkg/http_server/lib/src/http_multipart_form_data.dart b/pkg/http_server/lib/src/http_multipart_form_data.dart index eae575bda17..ec98d75af0a 100644 --- a/pkg/http_server/lib/src/http_multipart_form_data.dart +++ b/pkg/http_server/lib/src/http_multipart_form_data.dart @@ -2,8 +2,15 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.http_multipart_form_data; +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:mime/mime.dart'; + +import 'http_multipart_form_data_impl.dart'; /** * [:HttpMultipartFormData:] class used for 'upgrading' a [MimeMultipart] by @@ -76,5 +83,5 @@ abstract class HttpMultipartFormData implements Stream { */ static HttpMultipartFormData parse(MimeMultipart multipart, {Encoding defaultEncoding: UTF8}) - => _HttpMultipartFormData.parse(multipart, defaultEncoding); + => HttpMultipartFormDataImpl.parse(multipart, defaultEncoding); } diff --git a/pkg/http_server/lib/src/http_multipart_form_data_impl.dart b/pkg/http_server/lib/src/http_multipart_form_data_impl.dart index ed41d1df827..dc72bf1fb00 100644 --- a/pkg/http_server/lib/src/http_multipart_form_data_impl.dart +++ b/pkg/http_server/lib/src/http_multipart_form_data_impl.dart @@ -2,10 +2,18 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.http_multipart_form_data_impl; +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; -class _HttpMultipartFormData extends Stream implements HttpMultipartFormData { +import 'package:mime/mime.dart'; + +import 'http_multipart_form_data.dart'; + +class HttpMultipartFormDataImpl extends Stream + implements HttpMultipartFormData { final ContentType contentType; final HeaderValue contentDisposition; final HeaderValue contentTransferEncoding; @@ -16,7 +24,7 @@ class _HttpMultipartFormData extends Stream implements HttpMultipartFormData { Stream _stream; - _HttpMultipartFormData(ContentType this.contentType, + HttpMultipartFormDataImpl(ContentType this.contentType, HeaderValue this.contentDisposition, HeaderValue this.contentTransferEncoding, MimeMultipart this._mimeMultipart, @@ -74,7 +82,7 @@ class _HttpMultipartFormData extends Stream implements HttpMultipartFormData { throw new HttpException( "Mime Multipart doesn't contain a Content-Disposition header value"); } - return new _HttpMultipartFormData( + return new HttpMultipartFormDataImpl( type, disposition, encoding, multipart, defaultEncoding); } diff --git a/pkg/http_server/lib/src/virtual_directory.dart b/pkg/http_server/lib/src/virtual_directory.dart index d82fd992c6e..bd8ca73ef84 100644 --- a/pkg/http_server/lib/src/virtual_directory.dart +++ b/pkg/http_server/lib/src/virtual_directory.dart @@ -2,8 +2,14 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.virtual_directory; +import 'dart:async'; +import 'dart:convert'; +import 'dart:io'; + +import 'package:mime/mime.dart'; +import 'package:path/path.dart'; // Used for signal a directory redirecting, where a tailing slash is missing. class _DirectoryRedirect { diff --git a/pkg/http_server/lib/src/virtual_host.dart b/pkg/http_server/lib/src/virtual_host.dart index 4c67eca017b..9c5229c33e4 100644 --- a/pkg/http_server/lib/src/virtual_host.dart +++ b/pkg/http_server/lib/src/virtual_host.dart @@ -2,8 +2,10 @@ // for details. All rights reserved. Use of this source code is governed by a // BSD-style license that can be found in the LICENSE file. -part of http_server; +library http_server.virtual_host; +import 'dart:async'; +import 'dart:io'; /** * The [VirtualHost] class is a utility class for handling multiple hosts on diff --git a/pkg/http_server/pubspec.yaml b/pkg/http_server/pubspec.yaml index 02c811012d0..6bf4501d8f5 100644 --- a/pkg/http_server/pubspec.yaml +++ b/pkg/http_server/pubspec.yaml @@ -1,12 +1,12 @@ name: http_server -version: 0.9.5 +version: 0.9.5+1 author: Dart Team description: Library of HTTP server classes. homepage: http://www.dartlang.org -dependencies: - mime: ">=0.9.0 <0.10.0" - path: ">=0.9.0 <2.0.0" -dev_dependencies: - unittest: ">=0.10.0 <0.12.0" environment: - sdk: ">=1.0.0 <2.0.0" + sdk: '>=1.0.0 <2.0.0' +dependencies: + mime: '>=0.9.0 <0.10.0' + path: '>=0.9.0 <2.0.0' +dev_dependencies: + unittest: '>=0.10.0 <0.12.0'