Skip to content

Commit 5a85315

Browse files
Merge branch 'master' into master
2 parents 1e42688 + fab3248 commit 5a85315

File tree

93 files changed

+16406
-1578
lines changed

Some content is hidden

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

93 files changed

+16406
-1578
lines changed
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ master ]
17+
pull_request:
18+
# The branches below must be a subset of the branches above
19+
branches: [ master ]
20+
schedule:
21+
- cron: '23 14 * * 0'
22+
23+
jobs:
24+
analyze:
25+
name: Analyze
26+
runs-on: ubuntu-latest
27+
permissions:
28+
actions: read
29+
contents: read
30+
security-events: write
31+
32+
strategy:
33+
fail-fast: false
34+
matrix:
35+
language: [ 'javascript' ]
36+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
37+
# Learn more:
38+
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
39+
40+
steps:
41+
- name: Checkout repository
42+
uses: actions/checkout@v2
43+
44+
# Initializes the CodeQL tools for scanning.
45+
- name: Initialize CodeQL
46+
uses: github/codeql-action/init@v1
47+
with:
48+
languages: ${{ matrix.language }}
49+
# If you wish to specify custom queries, you can do so here or in a config file.
50+
# By default, queries listed here will override any specified in a config file.
51+
# Prefix the list here with "+" to use these queries and those in the config file.
52+
# queries: ./path/to/local/query, your-org/your-repo/queries@main
53+
54+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
55+
# If this step fails, then you should remove it and run the build manually (see below)
56+
- name: Autobuild
57+
uses: github/codeql-action/autobuild@v1
58+
59+
# ℹ️ Command-line programs to run using the OS shell.
60+
# 📚 https://git.io/JvXDl
61+
62+
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
63+
# and modify them (or add more) to build your code if your project
64+
# uses a compiled language
65+
66+
#- run: |
67+
# make bootstrap
68+
# make release
69+
70+
- name: Perform CodeQL Analysis
71+
uses: github/codeql-action/analyze@v1

.github/workflows/node.js.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Node.js CI
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
build:
14+
name: Test
15+
runs-on: ${{ matrix.os }}
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
node-version: [10.x, 12.x, 14.x, 16.x]
21+
os: [ubuntu-latest, macOS-latest, windows-latest]
22+
23+
steps:
24+
- uses: actions/checkout@v2
25+
- name: Use Node.js ${{ matrix.node-version }} on ${{ matrix.os }}
26+
uses: actions/setup-node@v2
27+
with:
28+
node-version: ${{ matrix.node-version }}
29+
cache: 'npm'
30+
- run: npx npm@7 ci
31+
- run: npm test

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
node_modules/*
2-
npm-debug.log
1+
node_modules/
2+
npm-debug.log*
3+
.nyc_*/
34
.dir-locals.el
45
.DS_Store

.travis.yml

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

LICENSE

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

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

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![build status](https://img.shields.io/travis/http-party/http-server.svg?style=flat-square)](https://travis-ci.org/http-party/http-server)
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)
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)
33
[![license](https://img.shields.io/github/license/http-party/http-server.svg?style=flat-square)](https://github.com/http-party/http-server)
44

55
# http-server: a command-line http server
@@ -42,7 +42,7 @@ 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)
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`.
4646

4747
`-a` Address to use (defaults to 0.0.0.0)
4848

@@ -84,6 +84,8 @@ Using `npx` you can run the script without installing it first:
8484

8585
`--no-dotfiles` Do not show dotfiles
8686

87+
`--mimetypes` Path to a .types file for custom mimetype definition
88+
8789
`-h` or `--help` Print this list and exit.
8890

8991
`-v` or `--version` Print the version and exit.

SECURITY.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Security Policy
2+
3+
## Supported Versions
4+
5+
| Version | Supported |
6+
| ------- | ------------------ |
7+
| 0.12.x | :white_check_mark: |
8+
| < 0.12 | :x: |
9+
10+
## Reporting a Vulnerability
11+
12+
In general, vulnerabilities can be reported as an issue, pull requests are very welcome. If you'd like to report privately, please email jademichael+http-server@jmthornton.net.

bin/http-server

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ var colors = require('colors/safe'),
88
portfinder = require('portfinder'),
99
opener = require('opener'),
1010
fs = require('fs'),
11-
argv = require('optimist')
12-
.boolean('cors')
13-
.boolean('log-ip')
14-
.argv;
11+
argv = require('minimist')(process.argv.slice(2));
1512
var ifaces = os.networkInterfaces();
1613

1714
process.title = 'http-server';
@@ -21,7 +18,7 @@ if (argv.h || argv.help) {
2118
'usage: http-server [path] [options]',
2219
'',
2320
'options:',
24-
' -p --port Port to use [8080]. If --https-redirect, http and (main) https port [8080,443]',
21+
' -p --port Port to use. If 0, look for open port. [8080]. If --https-redirect, http and (main) https port [8080,443]',
2522
' -a Address to use [0.0.0.0]',
2623
' -d Show directory listings [true]',
2724
' -i Display autoIndex [true]',
@@ -55,6 +52,7 @@ if (argv.h || argv.help) {
5552
'',
5653
' -r --robots Respond to /robots.txt [User-agent: *\\nDisallow: /]',
5754
' --no-dotfiles Do not show dotfiles',
55+
' --mimetypes Path to a .types file for custom mimetype definition',
5856
' -h --help Print this list and exit.',
5957
' -v --version Print the version and exit.'
6058
].join('\n'));
@@ -171,6 +169,7 @@ function listen(port, redirectPort) {
171169
proxy: proxy,
172170
httpsPort: redirectPort,
173171
showDotfiles: argv.dotfiles,
172+
mimetypes: argv.mimetypes,
174173
username: argv.username || process.env.NODE_HTTP_SERVER_USERNAME,
175174
password: argv.password || process.env.NODE_HTTP_SERVER_PASSWORD
176175
};

doc/http-server.1

Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
.TH http-server 1 "April 2020" GNU "http-server man page"
2+
3+
.SH NAME
4+
http-server \- a simple zero-configuration command-line http server
5+
6+
.SH SYNOPSIS
7+
.B http-server
8+
[\fIPATH\fR]
9+
[\fIOPTIONS\fR]
10+
11+
.SH DESCRIPTION
12+
\fBhttp-server\fR 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.
13+
14+
.SH OPTIONS
15+
16+
.TP
17+
.BI [\fIPATH\fR]
18+
The directory to serve.
19+
Defaults to ./public if it exists, and ./ otherwise.
20+
21+
.TP
22+
.BI \-p ", " \-\-port " " \fIPORT\fR
23+
Port to use. If 0, look for the first available port, starting at 8080.
24+
Default is 8080.
25+
26+
.TP
27+
.BI \-a " " \fIADDRESS\fR
28+
Address to use.
29+
Default is 0.0.0.0.
30+
31+
.TP
32+
.BI \-d
33+
Show directory listings.
34+
Default is true.
35+
36+
.TP
37+
.BI \-i
38+
Display autoIndex.
39+
Default is true.
40+
41+
.TP
42+
.BI \-g ", " \-\-gzip
43+
Serve gzip files when possible.
44+
Default is false.
45+
46+
.TP
47+
.BI \-b ", " \-\-brotli
48+
Serve brotli files when possible.
49+
If both brotli and gzip are enabled, brotli takes precedence.
50+
Default is false.
51+
52+
.TP
53+
.BI \-e ", " \-\-ext " " \fIEXTENSION\fR
54+
Default file extension is none is provided.
55+
56+
.TP
57+
.BI \-s ", " \-\-silent
58+
Suppress log messages from output.
59+
60+
.TP
61+
.BI \-\-cors " " [\fIHEADERS\fR]
62+
Enable CORS via the "Access-Control-Allow-Origin" header.
63+
Optionally provide CORS headers list separated by commas.
64+
65+
.TP
66+
.BI \-o " " [\fIPATH\fR]
67+
Open default browser window after starting the server.
68+
Optionally provide a URL path to open the browser window to.
69+
70+
.TP
71+
.BI \-c " " \fITIME\fR
72+
Cache time (max-age) in seconds.
73+
To disable caching, use \-c \-1.
74+
Default is 3600.
75+
76+
.TP
77+
.BI \-U ", " \-\-utc
78+
Use UTC time format in log messages.
79+
80+
.TP
81+
.BI \-\-log\-ip
82+
Enable logging of the client IP address.
83+
84+
.TP
85+
.BI \-P ", " \-\-proxy
86+
Fallback proxy if the request cannot be resolved.
87+
88+
.TP
89+
.BI \-\-username " " \fIUSERNAME\fR
90+
Username for basic authentication.
91+
Can also be specified with the environment variable NODE_HTTP_SERVER_USERNAME.
92+
Defaults to none.
93+
94+
.TP
95+
.BI \-\-password " " \fIPASSWORD\fR
96+
Password for basic authentication.
97+
Can also be specified with the environment variable NODE_HTTP_SERVER_PASSWORD.
98+
Defaults to none.
99+
100+
.TP
101+
.BI \-S ", " \-\-ssl
102+
Enable https.
103+
104+
.TP
105+
.BI \-C ", " \-\-cert " " [\fIFILE\fR]
106+
Path to SSL certificate file.
107+
If not specified, uses cert.pem.
108+
109+
.TP
110+
.BI \-K ", " \-\-key " " [\fIFILE\fR]
111+
Path to SSL key file.
112+
If not specified, uses key.pem.
113+
114+
.TP
115+
.BI \-r ", " \-\-robots " " [\fIUSER\-AGENT\fR]
116+
Respond to /robots.txt request.
117+
If not specified, uses "User-agent: *\\nDisallow: /]"
118+
119+
.TP
120+
.BI \-\-no\-dotfiles
121+
Do not show dotfiles.
122+
123+
.TP
124+
.BI \-h ", " \-\-help
125+
Print usage and exit.
126+
127+
.TP
128+
.BI \-v ", " \-\-version
129+
Print version and exit.
130+
131+
.SH FILES
132+
.B index.html
133+
will be served as the default file to any directory requests.
134+
135+
.B 404.html
136+
will be served if a file is not found. This can be used for SPA hosting to serve the entry page.
137+
138+
.SH COPYING
139+
Copyright (c) 2011-2020 Charlie Robbins, Marak Squires, and the Contributors.
140+
Permission is hereby granted, free of charge, to any person obtaining
141+
a copy of this software and associated documentation files (the
142+
"Software"), to deal in the Software without restriction, including
143+
without limitation the rights to use, copy, modify, merge, publish,
144+
distribute, sublicense, and/or sell copies of the Software, and to
145+
permit persons to whom the Software is furnished to do so, subject to
146+
the following conditions:
147+
148+
The above copyright notice and this permission notice shall be
149+
included in all copies or substantial portions of the Software.
150+
151+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
152+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
153+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
154+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
155+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
156+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
157+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
158+
159+
.SH VERSION
160+
Version 0.12.2

0 commit comments

Comments
 (0)