Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bin/RokuWebDriver_linux
Binary file not shown.
Binary file modified bin/RokuWebDriver_mac
Binary file not shown.
Binary file modified bin/RokuWebDriver_win.exe
Binary file not shown.
4 changes: 2 additions & 2 deletions src/httpServer/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ func (s *Server) GetTimeoutsHandler() appHandler {
return &appError{ "The \"username\" field is required ", http.StatusBadRequest, nil}
}
pass := r.FormValue("password")
if user == "" {
if pass == "" {
return &appError{ "The \"password\" field is required ", http.StatusBadRequest, nil}
}
res, err := plugin.Load(bytes.NewReader(buf.Bytes()), user, pass);
Expand Down Expand Up @@ -820,4 +820,4 @@ func (s *Server) GetSourceHandler() appHandler {
}
}
return nodeArray
}
}
7 changes: 4 additions & 3 deletions src/httpServer/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,11 @@
package httpServer

import (
"github.com/gorilla/mux"
ecp "ecpClient"
"net/http"
"time"

"github.com/gorilla/mux"
"github.com/sirupsen/logrus"
)

Expand All @@ -46,9 +47,9 @@ func GetServerInstance() *Server {
return server
}

func (s *Server) Start() {
func (s *Server) Start(port string) {
s.SetUpRoutes()
err := http.ListenAndServe(":9000", nil)
err := http.ListenAndServe(":" + port, nil)
if err != http.ErrServerClosed {
logrus.WithError(err).Error("Http Server stopped unexpected")
} else {
Expand Down
19 changes: 15 additions & 4 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,21 @@
package main

import (
httpServer "httpServer"
"fmt"
httpServer "httpServer"
"os"
"regexp"
)

func main() {
server := httpServer.GetServerInstance()
server.Start()
}
defaultPort := "9000"
validPort := regexp.MustCompile(`^[0-9]+$`)
server := httpServer.GetServerInstance()
if len(os.Args) > 1 && validPort.MatchString(os.Args[1]) {
fmt.Println("Starting driver on port: " + os.Args[1])
server.Start(os.Args[1])
} else {
fmt.Println("Starting driver on port: " + defaultPort)
server.Start(defaultPort)
}
}