Skip to content

Commit b7caf44

Browse files
Merge branch 'master' into master
2 parents 5a85315 + 38d08ad commit b7caf44

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1067
-955
lines changed

.github/ISSUE_TEMPLATE

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,13 @@
66

77
<!-- Paste the error and / or stack trace here: -->
88

9+
**What actually happened?**
10+
911
**If the issue is a feature request, what is the motivation / use case for it?**
1012

1113
**Tell us about your environment**
1214
- **exact http-server version:**
1315
- **Node version:**
14-
- **Platform:**
16+
- **OS:**
1517

1618
**Other information (related issues, suggestions for a fix, etc):**

.github/PULL_REQUEST_TEMPLATE

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
**What changes did you make?**
2+
3+
**Provide some example code that this change will affect, if applicable:**
4+
5+
<!-- Paste the example code here: -->
6+
7+
**Is there anything you'd like reviewers to focus on?**
8+
19
**Please ensure that your pull request fulfills these requirements:**
210
- [ ] The pull request is being made against the `master` branch
311
- [ ] Tests for the changes have been added (for bug fixes / features)
12+
- [ ] New features/options have been documented in:
13+
- [ ] `http-server --help` text
14+
- [ ] README.md
15+
- [ ] doc/http-server.1
416

517
**What is the purpose of this pull request? (bug fix, enhancement, new feature,...)**
618

719
<!--
820
Link to the issue this pull request fixes here, if applicable: "Fixes #xxx" or "Resolves #xxx"
21+
22+
If your PR fixes multiple issues, list them individually like "Fixes #xx1, fixes #xx2, fixes #xx3". This is a quirk of how GitHub links issues.
923
-->
10-
11-
**What changes did you make?**
12-
13-
**Provide some example code that this change will affect, if applicable:**
14-
15-
<!-- Paste the example code here: -->
16-
17-
**Is there anything you'd like reviewers to focus on?**
18-
19-
**Please provide testing instructions, if applicable:**

.github/workflows/codeql-analysis.yml

Lines changed: 0 additions & 71 deletions
This file was deleted.

.github/workflows/node.js.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
node-version: [10.x, 12.x, 14.x, 16.x]
20+
node-version: [12.x, 14.x, 16.x]
2121
os: [ubuntu-latest, macOS-latest, windows-latest]
2222

2323
steps:

.github/workflows/stale.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Mark stale issues and pull requests
2+
3+
on:
4+
schedule:
5+
- cron: '25 12 * * *'
6+
7+
jobs:
8+
stale:
9+
10+
runs-on: ubuntu-latest
11+
permissions:
12+
issues: write
13+
pull-requests: write
14+
15+
steps:
16+
- uses: actions/stale@v4.0.0
17+
with:
18+
repo-token: ${{ secrets.GITHUB_TOKEN }}
19+
days-before-stale: 360
20+
days-before-issue-stale: 180
21+
days-before-pr-stale: 360
22+
stale-issue-message: 'This issue has been inactive for 180 days'
23+
stale-pr-message: 'This pull request has been inactive for 360 days'
24+
stale-issue-label: 'stale'
25+
stale-pr-label: 'stale'
26+
exempt-issue-labels: 'no-stale'
27+
exempt-pr-labels: 'no-stale'
28+
exempt-all-milestones: true
29+
days-before-close: -1

LICENSE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
Copyright (c) 2011-2021 Charlie Robbins, Marak Squires, Jade Michael Thornton
2-
and the Contributors.
1+
Copyright (c) 2011-2021 Charlie Robbins, Marak Squires, Jade Michael Thornton and the Contributors.
32

43
Permission is hereby granted, free of charge, to any person obtaining
54
a copy of this software and associated documentation files (the

README.md

Lines changed: 53 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
1-
![GitHub Workflow Status (master)](https://img.shields.io/github/workflow/status/http-party/http-server/Node.js%20CI/master?style=flat-square)
2-
[![npm](https://img.shields.io/npm/v/http-server.svg?style=flat-square)](https://www.npmjs.com/package/http-server) [![homebrew](https://img.shields.io/homebrew/v/http-server?style=flat-square)](https://formulae.brew.sh/formula/http-server) ![GitHub milestone](https://img.shields.io/github/milestones/progress-percent/http-party/http-server/4?label=next%20release%20progress&style=flat-square) [![npm downloads](https://img.shields.io/npm/dm/http-server?color=blue&label=npm%20downloads&style=flat-square)](https://www.npmjs.com/package/http-server)
1+
[![GitHub Workflow Status (master)](https://img.shields.io/github/workflow/status/http-party/http-server/Node.js%20CI/master?style=flat-square)](https://github.com/http-party/http-server/actions)
2+
[![npm](https://img.shields.io/npm/v/http-server.svg?style=flat-square)](https://www.npmjs.com/package/http-server) [![homebrew](https://img.shields.io/homebrew/v/http-server?style=flat-square)](https://formulae.brew.sh/formula/http-server) [![npm downloads](https://img.shields.io/npm/dm/http-server?color=blue&label=npm%20downloads&style=flat-square)](https://www.npmjs.com/package/http-server)
33
[![license](https://img.shields.io/github/license/http-party/http-server.svg?style=flat-square)](https://github.com/http-party/http-server)
44

5-
# http-server: a command-line http server
5+
# http-server: a simple static HTTP server
66

7-
`http-server` is a simple, zero-configuration command-line http server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development, and learning.
7+
`http-server` is a simple, zero-configuration command-line static HTTP server. It is powerful enough for production usage, but it's simple and hackable enough to be used for testing, local development and learning.
88

99
![Example of running http-server](https://github.com/http-party/http-server/raw/master/screenshots/public.png)
1010

1111
## Installation:
1212

13+
#### Running on-demand:
14+
15+
Using `npx` you can run the script without installing it first:
16+
17+
npx http-server [path] [options]
18+
1319
#### Globally via `npm`
1420

1521
npm install --global http-server
@@ -19,12 +25,6 @@ This will install `http-server` globally so that it may be run from the command
1925
#### Globally via Homebrew
2026

2127
brew install http-server
22-
23-
#### Running on-demand:
24-
25-
Using `npx` you can run the script without installing it first:
26-
27-
npx http-server [path] [options]
2828
2929
#### As a dependency in your `npm` package:
3030

@@ -42,53 +42,34 @@ Using `npx` you can run the script without installing it first:
4242

4343
## Available Options:
4444

45-
`-p` or `--port` Port to use (defaults to 8080). Use `-p 0` to look for an open port, starting at 8080. It will also read from `process.env.PORT`.
46-
47-
`-a` Address to use (defaults to 0.0.0.0)
48-
49-
`-d` Show directory listings (defaults to `true`)
50-
51-
`-i` Display autoIndex (defaults to `true`)
52-
53-
`-g` or `--gzip` When enabled (defaults to `false`) it will serve `./public/some-file.js.gz` in place of `./public/some-file.js` when a gzipped version of the file exists and the request accepts gzip encoding. If brotli is also enabled, it will try to serve brotli first.
54-
55-
`-b` or `--brotli` When enabled (defaults to `false`) it will serve `./public/some-file.js.br` in place of `./public/some-file.js` when a brotli compressed version of the file exists and the request accepts `br` encoding. If gzip is also enabled, it will try to serve brotli first.
56-
57-
`-e` or `--ext` Default file extension if none supplied (defaults to `html`)
58-
59-
`-s` or `--silent` Suppress log messages from output
60-
61-
`--cors` Enable CORS via the `Access-Control-Allow-Origin` header
62-
63-
`-o [path]` Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/
64-
65-
`-c` Set cache time (in seconds) for cache-control max-age header, e.g. `-c10` for 10 seconds (defaults to `3600`). To disable caching, use `-c-1`.
66-
67-
`-U` or `--utc` Use UTC time format in log messages.
68-
69-
`--log-ip` Enable logging of the client's IP address (default: `false`).
70-
71-
`-P` or `--proxy` Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com
72-
73-
`--username` Username for basic authentication [none]
74-
75-
`--password` Password for basic authentication [none]
76-
77-
`-S` or `--ssl` Enable https.
78-
79-
`-C` or `--cert` Path to ssl cert file (default: `cert.pem`).
80-
81-
`-K` or `--key` Path to ssl key file (default: `key.pem`).
82-
83-
`-r` or `--robots` Provide a /robots.txt (whose content defaults to `User-agent: *\nDisallow: /`)
84-
85-
`--no-dotfiles` Do not show dotfiles
86-
87-
`--mimetypes` Path to a .types file for custom mimetype definition
88-
89-
`-h` or `--help` Print this list and exit.
90-
91-
`-v` or `--version` Print the version and exit.
45+
| Command | Description | Defaults |
46+
| ------------- |-------------|-------------|
47+
|`-p` or `--port` |Port to use. Use `-p 0` to look for an open port, starting at 8080. It will also read from `process.env.PORT`. |8080 |
48+
|`-a` |Address to use |0.0.0.0|
49+
|`-d` |Show directory listings |`true` |
50+
|`-i` | Display autoIndex | `true` |
51+
|`-g` or `--gzip` |When enabled it will serve `./public/some-file.js.gz` in place of `./public/some-file.js` when a gzipped version of the file exists and the request accepts gzip encoding. If brotli is also enabled, it will try to serve brotli first.|`false`|
52+
|`-b` or `--brotli`|When enabled it will serve `./public/some-file.js.br` in place of `./public/some-file.js` when a brotli compressed version of the file exists and the request accepts `br` encoding. If gzip is also enabled, it will try to serve brotli first. |`false`|
53+
|`-e` or `--ext` |Default file extension if none supplied |`html` |
54+
|`-s` or `--silent` |Suppress log messages from output | |
55+
|`--cors` |Enable CORS via the `Access-Control-Allow-Origin` header | |
56+
|`-o [path]` |Open browser window after starting the server. Optionally provide a URL path to open. e.g.: -o /other/dir/ | |
57+
|`-c` |Set cache time (in seconds) for cache-control max-age header, e.g. `-c10` for 10 seconds. To disable caching, use `-c-1`.|`3600` |
58+
|`-U` or `--utc` |Use UTC time format in log messages.| |
59+
|`--log-ip` |Enable logging of the client's IP address |`false` |
60+
|`-P` or `--proxy` |Proxies all requests which can't be resolved locally to the given url. e.g.: -P http://someurl.com | |
61+
|`--proxy-options` Pass proxy [options](https://github.com/http-party/node-http-proxy#options) using nested dotted objects. e.g.: --proxy-options.secure false
62+
63+
|`--username` |Username for basic authentication | |
64+
|`--password` |Password for basic authentication | |
65+
|`-S`, `--tls` or `--ssl` |Enable secure request serving with TLS/SSL (HTTPS)|`false`|
66+
|`-C` or `--cert` |Path to ssl cert file |`cert.pem` |
67+
|`-K` or `--key` |Path to ssl key file |`key.pem` |
68+
|`-r` or `--robots` | Automatically provide a /robots.txt (The content of which defaults to `User-agent: *\nDisallow: /`) | `false` |
69+
|`--no-dotfiles` |Do not show dotfiles| |
70+
|`--mimetypes` |Path to a .types file for custom mimetype definition| |
71+
|`-h` or `--help` |Print this list and exit. | |
72+
|`-v` or `--version`|Print the version and exit. | |
9273

9374
## Magic Files
9475

@@ -127,10 +108,21 @@ This is what should be output if successful:
127108

128109
``` sh
129110
Starting up http-server, serving ./ through https
111+
112+
http-server settings:
113+
CORS: disabled
114+
Cache: 3600 seconds
115+
Connection Timeout: 120 seconds
116+
Directory Listings: visible
117+
AutoIndex: visible
118+
Serve GZIP Files: false
119+
Serve Brotli Files: false
120+
Default File Extension: none
121+
130122
Available on:
131-
https:127.0.0.1:8080
132-
https:192.168.1.101:8080
133-
https:192.168.1.104:8080
123+
https://127.0.0.1:8080
124+
https://192.168.1.101:8080
125+
https://192.168.1.104:8080
134126
Hit CTRL-C to stop the server
135127
```
136128

@@ -140,7 +132,7 @@ Checkout this repository locally, then:
140132

141133
```sh
142134
$ npm i
143-
$ node bin/http-server
135+
$ npm start
144136
```
145137

146138
*Now you can visit http://localhost:8080 to view your server*

SECURITY.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22

33
## Supported Versions
44

5-
| Version | Supported |
6-
| ------- | ------------------ |
7-
| 0.12.x | :white_check_mark: |
8-
| < 0.12 | :x: |
5+
| Version | Supported |
6+
|---------|------------------------|
7+
| 13.0.x | ✔️ Yes |
8+
| 0.13.x | ❌ No |
9+
| 0.12.x | 🔐 Security updates until January 2022 |
10+
| < 0.12 | ❌ No |
911

1012
## Reporting a Vulnerability
1113

0 commit comments

Comments
 (0)