Skip to content

Commit

Permalink
Starting some reworking with promising changes and fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
asergeyev committed Dec 14, 2017
1 parent 238bbca commit 9f7a6a7
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 15 deletions.
5 changes: 5 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
Version 0.3.0 (??, 2017)

* Migration of underlying websocket server to Gorilla Websocket lib.
* Binaries build code switched to 1.9.2

Version 0.2.12 (Feb 17, 2016)

* Update of underlying go standard libraries change how SSL works. SSL3 is no longer supported.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ from disk using a `file://` URL.
More Features
-------------

* Very simple install. Just [download](https://github.com/joewalnes/websocketd/wiki/Download-and-install) the single executable for Linux, Mac or Windows and run it. No dependencies, no installers, no package managers, no external libraries. Suitable for development and production servers.
* Very simple install. Just [download](https://github.com/joewalnes/websocketd/wiki/Download-and-install) the single executable for Linux, Mac or Windows and run it. Minimal dependencies, no installers, no package managers, no external libraries. Suitable for development and production servers.
* Server side scripts can access details about the WebSocket HTTP request (e.g. remote host, query parameters, cookies, path, etc) via standard [CGI environment variables](https://github.com/joewalnes/websocketd/wiki/Environment-variables).
* As well as serving websocket daemons it also includes a static file server and classic CGI server for convenience.
* Command line help available via `websocketd --help`.
Expand Down
20 changes: 10 additions & 10 deletions libwebsocketd/endpoint_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,30 +19,30 @@ var eol_answers = []string{

func TestTrimEOL(t *testing.T) {
for n := 0; n < len(eol_tests); n++ {
answ := trimEOL(eol_tests[n])
if answ != eol_answers[n] {
answ := trimEOL([]byte(eol_tests[n]))
if string(answ) != eol_answers[n] {
t.Errorf("Answer '%s' did not match predicted '%s'", answ, eol_answers[n])
}
}
}

func BenchmarkTrimEOL(b *testing.B) {
for n := 0; n < b.N; n++ {
trimEOL(eol_tests[n%len(eol_tests)])
trimEOL([]byte(eol_tests[n%len(eol_tests)]))
}
}

type TestEndpoint struct {
limit int
prefix string
c chan string
c chan []byte
result []string
}

func (e *TestEndpoint) StartReading() {
go func() {
for i := 0; i < e.limit; i++ {
e.c <- e.prefix + strconv.Itoa(i)
e.c <- []byte(e.prefix + strconv.Itoa(i))
}
time.Sleep(time.Millisecond) // should be enough for smaller channel to catch up with long one
close(e.c)
Expand All @@ -52,18 +52,18 @@ func (e *TestEndpoint) StartReading() {
func (e *TestEndpoint) Terminate() {
}

func (e *TestEndpoint) Output() chan string {
func (e *TestEndpoint) Output() chan []byte {
return e.c
}

func (e *TestEndpoint) Send(msg string) bool {
e.result = append(e.result, msg)
func (e *TestEndpoint) Send(msg []byte) bool {
e.result = append(e.result, string(msg))
return true
}

func TestEndpointPipe(t *testing.T) {
one := &TestEndpoint{2, "one:", make(chan string), make([]string, 0)}
two := &TestEndpoint{4, "two:", make(chan string), make([]string, 0)}
one := &TestEndpoint{2, "one:", make(chan []byte), make([]string, 0)}
two := &TestEndpoint{4, "two:", make(chan []byte), make([]string, 0)}
PipeEndpoints(one, two)
if len(one.result) != 4 || len(two.result) != 2 {
t.Errorf("Invalid lengths, should be 4 and 2: %v %v", one.result, two.result)
Expand Down
4 changes: 2 additions & 2 deletions libwebsocketd/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ Sec-WebSocket-Version: 13
}

var mimetest = [][3]string{
{"Content-type: text/plain", "Content-type", "text/plain"},
{"Content-type: ", "Content-type", ""},
{"Content-Type: text/plain", "Content-Type", "text/plain"},
{"Content-Type: ", "Content-Type", ""},
}

func TestSplitMimeHeader(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions release/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# Uses Semantic Versioning scheme - http://semver.org/
VERSION_MAJOR=0
VERSION_MINOR=2
VERSION_MINOR=3

# 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 \
Expand All @@ -19,7 +19,7 @@ LAST_PATCH_VERSION:=$(shell git ls-remote git@github.com:joewalnes/websocketd.gi
VERSION_PATCH:=$(if $(LAST_PATCH_VERSION),$(shell expr $(LAST_PATCH_VERSION)),0)
RELEASE_VERSION=$(VERSION_MAJOR).$(VERSION_MINOR).$(VERSION_PATCH)

GO_VERSION=1.6.2
GO_VERSION=1.9.2
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


Expand Down

0 comments on commit 9f7a6a7

Please sign in to comment.