Skip to content

Commit

Permalink
Merge branch 'release/0.9.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
nwtgck committed Mar 10, 2019
2 parents 61af41d + 4cbd78c commit 5f838b2
Show file tree
Hide file tree
Showing 9 changed files with 124 additions and 76 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
command: |
set -x
# Run a server
docker run -d -p 8080:8080 piping-server
docker run -d -p 8080:80 piping-server --http-port=80
# Wait for server running
sleep 1
# Create a file to send
Expand Down
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

## [Unreleased]

## [0.9.1] - 2019-03-10
### Fixed
* Allow user to ctrl-c to terminate piping-server docker container
### Changed
* Return "Content-Length" and "Content-Type" when accessing index, /version and /help

## [0.9.0] - 2019-03-08
### Changed
* Make logs for sender consistent
Expand Down Expand Up @@ -143,7 +149,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
* Docker automated build on Docker Hub
* Support HTTPS

[Unreleased]: https://github.com/nwtgck/piping-server/compare/v0.9.0...HEAD
[Unreleased]: https://github.com/nwtgck/piping-server/compare/v0.9.1...HEAD
[0.9.1]: https://github.com/nwtgck/piping-seraver/compare/v0.9.0...v0.9.1
[0.9.0]: https://github.com/nwtgck/piping-seraver/compare/v0.8.10...v0.9.0
[0.8.10]: https://github.com/nwtgck/piping-seraver/compare/v0.8.9...v0.8.10
[0.8.9]: https://github.com/nwtgck/piping-seraver/compare/v0.8.8...v0.8.9
Expand Down
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ FROM node:10.15-alpine

LABEL maintainer="Ryo Ota <[email protected]>"

RUN apk add --no-cache tini

COPY . /app

# Move to /app
Expand All @@ -13,5 +15,5 @@ RUN npm install && \
npm run build && \
npm prune --production

# Run entry (Run the server)
ENTRYPOINT ["node", "dist/src/index.js"]
# Run a server
ENTRYPOINT [ "tini", "--", "node", "dist/src/index.js" ]
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,17 @@ Options:
Run a Piping server on <http://localhost:8181> by the following command.

```bash
docker run -it -p 8181:8080 nwtgck/piping-server
docker run -p 8181:8080 nwtgck/piping-server
```

You can also specify options like the following.
You can also specify an option like the following.

```bash
docker run -it -p 8181:80 nwtgck/piping-server --http-port=80
docker run -p 8181:80 nwtgck/piping-server --http-port=80
```

You can run a server in background and it automatically always restarts.

```bash
docker run -p 8181:80 -d --restart=always nwtgck/piping-server --http-port=80
```
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "piping-server",
"version": "0.9.0",
"version": "0.9.1",
"description": "Streaming Data Transfer Server over HTTP/HTTPS",
"bin": {
"piping-server": "dist/src/index.js"
Expand Down
19 changes: 17 additions & 2 deletions src/piping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,10 +238,19 @@ export class Server {
case "GET":
switch (reqPath) {
case NAME_TO_RESERVED_PATH.index:
res.writeHead(200, {
"Content-Length": Buffer.byteLength(indexPage),
"Content-Type": "text/html"
});
res.end(indexPage);
break;
case NAME_TO_RESERVED_PATH.version:
res.end(VERSION + "\n");
const versionPage: string = VERSION + "\n";
res.writeHead(200, {
"Content-Length": Buffer.byteLength(versionPage),
"Content-Type": "text/plain"
});
res.end(versionPage);
break;
case NAME_TO_RESERVED_PATH.help:
// x-forwarded-proto is https or not
Expand All @@ -255,7 +264,13 @@ export class Server {
const hostname: string = req.headers.host || "hostname";
// tslint:disable-next-line:no-shadowed-variable
const url = `${scheme}://${hostname}`;
res.end(generateHelpPage(url));

const helpPage: string = generateHelpPage(url);
res.writeHead(200, {
"Content-Length": Buffer.byteLength(helpPage),
"Content-Type": "text/plain"
});
res.end(helpPage);
break;
case NAME_TO_RESERVED_PATH.faviconIco:
// (from: https://stackoverflow.com/a/35408810/2885946)
Expand Down
Loading

0 comments on commit 5f838b2

Please sign in to comment.