Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 16 additions & 17 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
## 4.2.0

- Added support for `https`.
- Support multiple `--headers` flags and more robust header value parsing.
For example: `--headers="header1=value1;header2=value2"` or
- Support multiple `--headers` flags and more robust header value parsing. For
example: `--headers="header1=value1;header2=value2"` or
`--headers="header1=value1" --headers="header2=value2"`
- Added `--list-files` flag to show a directory listing when no `index.html` is
- Added `--list-files` flag to show a directory listing when no `index.html` is
present.
- Added `--version` flag.
- Added clickable link to serve output.
- Require `sdk: ^3.10.0`.

## 4.1.0

- Add "headers" option to add additional response headers.
For example: `--headers="header1=value;header2=value;"`
- Add "headers" option to add additional response headers. For example:
`--headers="header1=value;header2=value;"`
- Update minimum Dart SDK to `3.0.0`.

## 4.0.1
Expand All @@ -40,32 +40,31 @@

## 3.0.0

* Set Dart SDK constraint to '>=2.0.0-dev.48.0 <3.0.0'.
* Removed top-level fields `DEFAULT_PORT` and `DEFAULT_HOST` from library.
- Set Dart SDK constraint to '>=2.0.0-dev.48.0 <3.0.0'.
- Removed top-level fields `DEFAULT_PORT` and `DEFAULT_HOST` from library.

## 2.0.0

* Removed `allow-origin` flag. In reality, this flag never worked because the
- Removed `allow-origin` flag. In reality, this flag never worked because the
`shelf` pipeline was not configured correctly.

* Source moved to [github.com/kevmoo/dhttpd](https://github.com/kevmoo/dhttpd).
- Source moved to [github.com/kevmoo/dhttpd](https://github.com/kevmoo/dhttpd).

## 1.0.0

* No change in functionality, just version and doc tweaks.
- No change in functionality, just version and doc tweaks.

## 0.3.1

* Fixed bug with setting the path from the command line.
* Start the server with `dhttpd`.
- Fixed bug with setting the path from the command line.
- Start the server with `dhttpd`.

## 0.3.0

* New `host` command-line flag, to set
the hostname to listen on. Defaults
to `localhost`
- New `host` command-line flag, to set the hostname to listen on. Defaults to
`localhost`

## 0.2.0

* New `allow-origin` command-line flag for CORS headers.
Thanks to @gmosx for the patch.
- New `allow-origin` command-line flag for CORS headers. Thanks to @gmosx for
the patch.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
[![CI](https://github.com/kevmoo/dhttpd/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/kevmoo/dhttpd/actions/workflows/ci.yml)
[![package publisher](https://img.shields.io/pub/publisher/dhttpd.svg)](https://pub.dev/packages/dhttpd/publisher)

A simple HTTP server that can serve up any directory, built with Dart.
Inspired by `python -m SimpleHTTPServer`.
A simple HTTP server that can serve up any directory, built with Dart. Inspired
by `python -m SimpleHTTPServer`.

## Install

Expand All @@ -15,8 +15,8 @@ $ dart pub global activate dhttpd

## Use

If you have [modified your PATH][path], you can run this server from any
local directory.
If you have [modified your PATH][path], you can run this server from any local
directory.

```console
$ dhttpd
Expand All @@ -28,8 +28,7 @@ Otherwise you can use the `dart pub global` command.
$ dart pub global run dhttpd
```

Here's an example of creating a web app
and then running it with this server:
Here's an example of creating a web app and then running it with this server:

```console
$ dart create -t web web_app
Expand All @@ -41,14 +40,18 @@ $ dhttpd --path build/web/ # Serves app at http://localhost:8080

### HTTPS

If you want to use HTTPS you will need to pass in the path of the SSL certificate and the SSL key file as well as the password string, if a password is set on the key, for example:
If you want to use HTTPS you will need to pass in the path of the SSL
certificate and the SSL key file as well as the password string, if a password
is set on the key, for example:

```
$ dart bin/dhttpd.dart --sslcert=example/server_chain.pem --sslkey=example/server_key.pem --sslkeypassword=dartdart
Server HTTPS started on port 8080
```

See the Dart documentation of [SecurityContext.usePrivateKey](https://api.dart.dev/stable/3.3.3/dart-io/SecurityContext/usePrivateKeyBytes.html) for more details.
See the Dart documentation of
[SecurityContext.usePrivateKey](https://api.dart.dev/stable/3.3.3/dart-io/SecurityContext/usePrivateKeyBytes.html)
for more details.

## Configure

Expand All @@ -69,4 +72,5 @@ $ dhttpd --help
--version Prints the version of dhttpd.
```

[path]: https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path
[path]:
https://dart.dev/tools/pub/cmd/pub-global#running-a-script-from-your-path