Skip to content

Commit

Permalink
Improving windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
asergeyev committed Dec 14, 2017
1 parent 9ba8d64 commit bcbce9f
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 18 deletions.
2 changes: 1 addition & 1 deletion examples/windows-jscript/count.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo count.js
cscript /nologo %0\..\count.js
2 changes: 1 addition & 1 deletion examples/windows-jscript/dump-env.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo dump-env.js
cscript /nologo %0\..\dump-env.js
2 changes: 1 addition & 1 deletion examples/windows-jscript/greeter.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo greeter.js
cscript /nologo %0\..\greeter.js
2 changes: 1 addition & 1 deletion examples/windows-vbscript/count.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo count.vbs
cscript /nologo %0\..\count.vbs
2 changes: 1 addition & 1 deletion examples/windows-vbscript/dump-env.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo dump-env.vbs
cscript /nologo %0\..\dump-env.vbs
2 changes: 1 addition & 1 deletion examples/windows-vbscript/greeter.cmd
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
@echo off
cscript /nologo greeter.vbs
cscript /nologo %0\..\greeter.vbs
23 changes: 12 additions & 11 deletions help.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,31 +33,32 @@ Options:
--port=PORT HTTP port to listen on.
--address=ADDRESS Address to bind to (multiple options allowed)
Use square brackets to specify IPv6 address.
Use square brackets to specify IPv6 address.
Default: "" (all)
--sameorigin={true,false} Restrict (HTTP 403) protocol upgrades if the
Origin header does not match to requested HTTP
Origin header does not match to requested HTTP
Host. Default: false.
--origin=host[:port][,host[:port]...]
Restrict (HTTP 403) protocol upgrades if the
Origin header does not match to one of the host
and port combinations listed. If the port is not
specified, any port number will match.
specified, any port number will match.
Default: "" (allow any origin)
--ssl Listen for HTTPS socket instead of HTTP.
--ssl Listen for HTTPS socket instead of HTTP.
--sslcert=FILE All three options must be used or all of
--sslkey=FILE them should be omitted.
--sslkey=FILE them should be omitted.
--redirport=PORT Open alternative port and redirect HTTP traffic
from it to canonical address (mostly useful
for HTTPS-only configurations to redirect HTTP
traffic)
--passenv VAR[,VAR...] Lists environment variables allowed to be
passed to executed scripts.
passed to executed scripts. Does not work for
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
Expand All @@ -76,16 +77,16 @@ Options:
--cgidir=DIR Serve CGI scripts in this directory over HTTP.
--maxforks=N Limit number of processes that websocketd is
--maxforks=N Limit number of processes that websocketd is
able to execute with WS and CGI handlers.
When maxforks reached the server will be
rejecting requests that require executing
When maxforks reached the server will be
rejecting requests that require executing
another process (unlimited when 0 or negative).
Default: 0
--closems=milliseconds Specifies additional time process needs to gracefully
finish before websocketd will send termination signals
to it. Default: 0 (signals sent after 100ms, 250ms,
finish before websocketd will send termination signals
to it. Default: 0 (signals sent after 100ms, 250ms,
and 500ms of waiting)
--header="..." Set custom HTTP header to each answer. For
Expand Down
5 changes: 4 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"fmt"
"net/http"
"os"
"runtime"
"strconv"
"strings"

Expand Down Expand Up @@ -50,7 +51,9 @@ func main() {
}
}

os.Clearenv() // it's ok to wipe it clean, we already read env variables from passenv into config
if runtime.GOOS != "windows" { // windows relies on env variables to find its libs... e.g. socket stuff
os.Clearenv() // it's ok to wipe it clean, we already read env variables from passenv into config
}
handler := libwebsocketd.NewWebsocketdServer(config.Config, log, config.MaxForks)
http.Handle("/", handler)

Expand Down

0 comments on commit bcbce9f

Please sign in to comment.