diff -Nru websocketd-0.3.1/CHANGES websocketd-0.4.1/CHANGES --- websocketd-0.3.1/CHANGES 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/CHANGES 2021-01-25 00:59:31.000000000 +0000 @@ -1,3 +1,8 @@ +Version 0.4.1 (Jan 24, 2021) + +* Minor changes only +* Updated to Go 1.15.7 + Version 0.3.1 (Jan 28, 2019) * Minor improvements to websocketd itself diff -Nru websocketd-0.3.1/debian/changelog websocketd-0.4.1/debian/changelog --- websocketd-0.3.1/debian/changelog 2020-11-11 22:27:20.000000000 +0000 +++ websocketd-0.4.1/debian/changelog 2021-01-31 19:09:55.000000000 +0000 @@ -1,14 +1,11 @@ -websocketd (0.3.1-3build2) hirsute; urgency=medium +websocketd (0.4.1-1) unstable; urgency=medium - * No-change rebuild using new golang + * New upstream release (0.4.1-1) + * Update packate to use debhelper-compat (= 13) + * Bump Standards Version to 4.5.1. No changes required + * Mark autopkgtest as superficial - -- Steve Langasek Wed, 11 Nov 2020 22:27:20 +0000 - -websocketd (0.3.1-3build1) groovy; urgency=medium - - * No-change rebuild using new golang - - -- Steve Langasek Tue, 22 Sep 2020 08:56:04 +0000 + -- Josue Ortega Sun, 31 Jan 2021 13:09:55 -0600 websocketd (0.3.1-3) unstable; urgency=medium diff -Nru websocketd-0.3.1/debian/control websocketd-0.4.1/debian/control --- websocketd-0.3.1/debian/control 2020-09-22 08:56:04.000000000 +0000 +++ websocketd-0.4.1/debian/control 2021-01-31 19:09:55.000000000 +0000 @@ -1,13 +1,12 @@ Source: websocketd Section: web Priority: optional -Maintainer: Ubuntu Developers -XSBC-Original-Maintainer: Josue Ortega -Build-Depends: debhelper-compat (= 12), +Maintainer: Josue Ortega +Build-Depends: debhelper-compat (= 13), dh-golang, golang-any, golang-github-gorilla-websocket-dev -Standards-Version: 4.4.1 +Standards-Version: 4.5.1 Homepage: https://github.com/joewalnes/websocketd Vcs-Browser: https://salsa.debian.org/debian/websocketd Vcs-Git: https://salsa.debian.org/debian/websocketd.git diff -Nru websocketd-0.3.1/debian/tests/control websocketd-0.4.1/debian/tests/control --- websocketd-0.3.1/debian/tests/control 2019-11-10 18:54:07.000000000 +0000 +++ websocketd-0.4.1/debian/tests/control 2021-01-31 19:09:55.000000000 +0000 @@ -1 +1,2 @@ Test-Command: websocketd --version +Restrictions: superficial diff -Nru websocketd-0.3.1/examples/hack/count.hh websocketd-0.4.1/examples/hack/count.hh --- websocketd-0.3.1/examples/hack/count.hh 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/hack/count.hh 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,24 @@ +#!/usr/bin/hhvm +> +async function count_to_ten(): Awaitable { + $output = request_output(); + for ($count = 1; $count <= 10; $count++) { + await $output->writeAsync( + Str\format("%d\n",$count) + ); + + HH\Asio\usleep(500000); + } + + // flush output + await $output->flushAsync(); + + exit(0); +} diff -Nru websocketd-0.3.1/examples/hack/dump-env.hh websocketd-0.4.1/examples/hack/dump-env.hh --- websocketd-0.3.1/examples/hack/dump-env.hh 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/hack/dump-env.hh 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,59 @@ +#!/usr/bin/hhvm +> +async function dumpEnv(): Awaitable { + // Standard CGI(ish) environment variables, as defined in + // http://tools.ietf.org/html/rfc3875 + $names = keyset[ + 'AUTH_TYPE', + 'CONTENT_LENGTH', + 'CONTENT_TYPE', + 'GATEWAY_INTERFACE', + 'PATH_INFO', + 'PATH_TRANSLATED', + 'QUERY_STRING', + 'REMOTE_ADDR', + 'REMOTE_HOST', + 'REMOTE_IDENT', + 'REMOTE_PORT', + 'REMOTE_USER', + 'REQUEST_METHOD', + 'REQUEST_URI', + 'SCRIPT_NAME', + 'SERVER_NAME', + 'SERVER_PORT', + 'SERVER_PROTOCOL', + 'SERVER_SOFTWARE', + 'UNIQUE_ID', + 'HTTPS' + ]; + + /* HH_IGNORE_ERROR[2050] using global variable */ + $server = dict($_SERVER); + + $ouput = request_output(); + + foreach($names as $name) { + await $output->writeAsync( + Str\format("%s = %s\n", $name, $server[$name] ?? '') + ); + } + + // Additional HTTP headers + foreach($server as $k => $v) { + if ($k is string && Str\starts_with($k, 'HTTP_')) { + await $output->writeAsync( + Str\format("%s = %s\n", $k, $v as string) + ); + } + } + + // flush output + await $output->flushAsync(); + + exit(0); +} diff -Nru websocketd-0.3.1/examples/hack/greeter.hh websocketd-0.4.1/examples/hack/greeter.hh --- websocketd-0.3.1/examples/hack/greeter.hh 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/hack/greeter.hh 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,22 @@ +#!/usr/bin/hhvm +> +async function greeter(): Awaitable { + // For each line FOO received on STDIN, respond with "Hello FOO!". + $input = IO\request_input(); + $output = IO\request_output(); + while(!$input->isEndOfFile()) { + await $ouput->writeAsync( + Str\format("Hello %s!\n", await $input->readLineAsync()) + ); + } + + // flush output + await $output->flushAsync(); + + exit(0); +} diff -Nru websocketd-0.3.1/examples/hack/README.md websocketd-0.4.1/examples/hack/README.md --- websocketd-0.3.1/examples/hack/README.md 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/hack/README.md 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,23 @@ +This examples directory shows some examples written in [Hack](https://hacklang.org). + +### Requirements : + +- [HHVM](https://github.com/facebook/hhvm) 3.30+ +- [HSL ( Hack Standard Library )](https://github.com/hhvm/hsl) 3.30+ +- [HSL Experimental](https://github.com/hhvm/hsl-experimental) 3.30+ + +You can also test the command files by running from the command line : + +``` +$ hhvm count.hh +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +``` diff -Nru websocketd-0.3.1/examples/nodejs/README.md websocketd-0.4.1/examples/nodejs/README.md --- websocketd-0.3.1/examples/nodejs/README.md 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/examples/nodejs/README.md 2021-01-25 00:59:31.000000000 +0000 @@ -6,8 +6,8 @@ ##### 2. Start a server: getter -Run `websocketd --port=8080 --devconsole ./getter.js` and then go to `http://localhost:8080` to interact with it +Run `websocketd --port=8080 --devconsole node greeter.js` and then go to `http://localhost:8080` to interact with it ##### 3. Start a server: counter -Run `websocketd --port=8080 ./counter.js` to start the server, then go to [examples/html](https://github.com/joewalnes/websocketd/tree/master/examples/html) directory and double click **count.html** to open in a browser +Run `websocketd --port=8080 node count.js` to start the server, then go to [examples/html](https://github.com/joewalnes/websocketd/tree/master/examples/html) directory and double click **count.html** to open in a browser diff -Nru websocketd-0.3.1/examples/rust/count.rs websocketd-0.4.1/examples/rust/count.rs --- websocketd-0.3.1/examples/rust/count.rs 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/rust/count.rs 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,11 @@ +use std::io::{self, Write}; +use std::{thread, time}; + +// Simple example script that counts to 10 at ~2Hz, then stops. +fn main() { + for i in 1..11 { + println!("{}", i); + io::stdout().flush().ok().expect("Could not flush stdout"); + thread::sleep(time::Duration::from_millis(500)); + } +} diff -Nru websocketd-0.3.1/examples/rust/dump-env.rs websocketd-0.4.1/examples/rust/dump-env.rs --- websocketd-0.3.1/examples/rust/dump-env.rs 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/rust/dump-env.rs 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,40 @@ +// Standard CGI(ish) environment variables, as defined in +// http://tools.ietf.org/html/rfc3875 + +use std::env; + +const NAMES: &'static [&'static str] = &[ + "AUTH_TYPE", + "CONTENT_LENGTH", + "CONTENT_TYPE", + "GATEWAY_INTERFACE", + "PATH_INFO", + "PATH_TRANSLATED", + "QUERY_STRING", + "REMOTE_ADDR", + "REMOTE_HOST", + "REMOTE_IDENT", + "REMOTE_PORT", + "REMOTE_USER", + "REQUEST_METHOD", + "REQUEST_URI", + "SCRIPT_NAME", + "SERVER_NAME", + "SERVER_PORT", + "SERVER_PROTOCOL", + "SERVER_SOFTWARE", + "UNIQUE_ID", + "HTTPS", +]; + +fn main() { + for key in NAMES { + let value = env::var(key).unwrap_or(String::from("")); + println!("{}={}", key, value); + } + for (key, value) in env::vars() { + if key.starts_with("HTTP_") { + println!("{}={}", key, value); + } + } +} diff -Nru websocketd-0.3.1/examples/rust/greeter.rs websocketd-0.4.1/examples/rust/greeter.rs --- websocketd-0.3.1/examples/rust/greeter.rs 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/rust/greeter.rs 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,14 @@ +use std::io::{self, Write}; + +// For each line FOO received on STDIN, respond with "Hello FOO!". +fn main() { + loop { + let mut msg = String::new(); + io::stdin() + .read_line(&mut msg) + .expect("Failed to read line"); + let msg = msg.trim(); + println!("Hello {}!", msg); + io::stdout().flush().ok().expect("Could not flush stdout"); + } +} diff -Nru websocketd-0.3.1/examples/rust/README.txt websocketd-0.4.1/examples/rust/README.txt --- websocketd-0.3.1/examples/rust/README.txt 1970-01-01 00:00:00.000000000 +0000 +++ websocketd-0.4.1/examples/rust/README.txt 2021-01-25 00:59:31.000000000 +0000 @@ -0,0 +1,3 @@ +This examples directory shows some examples written in Rust. + +You can also test the command files by running from the command line. \ No newline at end of file diff -Nru websocketd-0.3.1/help.go websocketd-0.4.1/help.go --- websocketd-0.3.1/help.go 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/help.go 2021-01-25 00:59:31.000000000 +0000 @@ -58,7 +58,7 @@ --passenv VAR[,VAR...] Lists environment variables allowed to be passed to executed scripts. Does not work for - Windows since all the variables are kept there. + Windows since all the variables are kept there. --binary={true,false} Switches communication to binary, process reads send to browser as blobs and all reads from the diff -Nru websocketd-0.3.1/libwebsocketd/env.go websocketd-0.4.1/libwebsocketd/env.go --- websocketd-0.3.1/libwebsocketd/env.go 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/libwebsocketd/env.go 2021-01-25 00:59:31.000000000 +0000 @@ -42,9 +42,7 @@ env = appendEnv(env, "SERVER_SOFTWARE", handler.server.Config.ServerSoftware) parentStarts := len(env) - for _, v := range handler.server.Config.ParentEnv { - env = append(env, v) - } + env = append(env, handler.server.Config.ParentEnv...) // IMPORTANT ---> Adding a header? Make sure standardEnvCount (above) is up to date. diff -Nru websocketd-0.3.1/libwebsocketd/http.go websocketd-0.4.1/libwebsocketd/http.go --- websocketd-0.3.1/libwebsocketd/http.go 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/libwebsocketd/http.go 2021-01-25 00:59:31.000000000 +0000 @@ -71,7 +71,7 @@ if h.Config.CommandName != "" || h.Config.UsingScriptDir { hdrs := req.Header - upgradeRe := regexp.MustCompile("(?i)(^|[,\\s])Upgrade($|[,\\s])") + upgradeRe := regexp.MustCompile(`(?i)(^|[,\s])Upgrade($|[,\s])`) // WebSocket, limited to size of h.forks if strings.ToLower(hdrs.Get("Upgrade")) == "websocket" && upgradeRe.MatchString(hdrs.Get("Connection")) { if h.noteForkCreated() == nil { @@ -118,7 +118,7 @@ } else { log.Error("http", "Max of possible forks already active, upgrade rejected") - http.Error(w, "429 Too Many Requests", 429) + http.Error(w, "429 Too Many Requests", http.StatusTooManyRequests) } return } @@ -162,7 +162,7 @@ cgiHandler.ServeHTTP(w, req) } else { log.Error("http", "Fork not allowed since maxforks amount has been reached. CGI was not run.") - http.Error(w, "429 Too Many Requests", 429) + http.Error(w, "429 Too Many Requests", http.StatusTooManyRequests) } return } @@ -228,7 +228,6 @@ panic("Cannot deplet number of allowed forks, something is not right in code!") } } - return } func checkOrigin(req *http.Request, config *Config, log *LogScope) (err error) { diff -Nru websocketd-0.3.1/main.go websocketd-0.4.1/main.go --- websocketd-0.3.1/main.go 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/main.go 2021-01-25 00:59:31.000000000 +0000 @@ -109,8 +109,8 @@ }(addrSingle) } } - select { - case err := <-rejects: + err := <-rejects + if err != nil { log.Fatal("server", "Can't start server: %s", err) os.Exit(3) } diff -Nru websocketd-0.3.1/Makefile websocketd-0.4.1/Makefile --- websocketd-0.3.1/Makefile 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/Makefile 2021-01-25 00:59:31.000000000 +0000 @@ -29,7 +29,7 @@ mkdir -p $(GO_DIR) rm -f $@ @echo Downloading and unpacking Go $(GO_VERSION) to $(GO_DIR) - curl -s $(GO_DOWNLOAD_URL) | tar xf - --strip-components=1 -C $(GO_DIR) + curl -s $(GO_DOWNLOAD_URL) | tar xfz - --strip-components=1 -C $(GO_DIR) # Clean up binary clean: diff -Nru websocketd-0.3.1/README.md websocketd-0.4.1/README.md --- websocketd-0.3.1/README.md 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/README.md 2021-01-25 00:59:31.000000000 +0000 @@ -67,7 +67,7 @@ $ websocketd --port=8080 ./count.sh ``` -Finally, let's create a web-page that to test it. +Finally, let's create a web-page to test it. __count.html__: @@ -115,9 +115,10 @@ ---------------- * [Plot real time Linux CPU/IO/Mem stats to a HTML5 dashboard using websocketd and vmstat](https://github.com/joewalnes/web-vmstats) _(for Linux)_ -* [Remote JScript & VBScript code execution tool based on websocketd](https://github.com/dab00/ws-console) _(for Windows)_ * [Arbitrary REPL in the browser using websocketd](https://github.com/rowanthorpe/ws-repl) * [Retrieve SQL data from server with LiveCode and webSocketd](https://github.com/samansjukur/wslc) +* [List files from a configured folder](https://github.com/dbalakirev/directator) _(for Linux)_ +* [Listen for gamepad events and report them to the system](https://github.com/experiment322/controlloid-server) _(this + android = gamepad emulator)_ Got more examples? Open a pull request. diff -Nru websocketd-0.3.1/release/Makefile websocketd-0.4.1/release/Makefile --- websocketd-0.3.1/release/Makefile 2019-01-28 13:31:15.000000000 +0000 +++ websocketd-0.4.1/release/Makefile 2021-01-25 00:59:31.000000000 +0000 @@ -5,7 +5,7 @@ # Uses Semantic Versioning scheme - http://semver.org/ VERSION_MAJOR=0 -VERSION_MINOR=3 +VERSION_MINOR=4 # Last part of version number (patch) is incremented automatically from Git tags LAST_PATCH_VERSION:=$(shell git ls-remote git@github.com:joewalnes/websocketd.git \ @@ -18,10 +18,10 @@ -VERSION_PATCH:=$(shell expr $$(( $(or $(LAST_PATCH_VERSION),-1) + 1 ))) +VERSION_PATCH:=$(or $(LAST_PATCH_VERSION),0) RELEASE_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH) -GO_VERSION=1.11.5 +GO_VERSION=1.15.7 PLATFORMS=linux_amd64 linux_386 linux_arm linux_arm64 darwin_amd64 freebsd_amd64 freebsd_386 windows_386 windows_amd64 openbsd_386 openbsd_amd64 solaris_amd64