Skip to content

Commit

Permalink
golang: correct served HTTP path
Browse files Browse the repository at this point in the history
* do not add the current path to the served path,
  the current path is already read by the flags
* as the path defaults to the current path,
  do not serve the current path, as this would
  make it possible to download the server in source
  or binary form
  • Loading branch information
ttefke committed Feb 15, 2022
1 parent 37f42ce commit 90b47f0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion golang/websockify.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ func main() {
log.Println(err)
}

http.Handle("/", http.FileServer(http.Dir(path+"/"+*web)))
if *web != path {
http.Handle("/", http.FileServer(http.Dir(*web)))
}
http.HandleFunc("/websockify", serveWs)
log.Fatal(http.ListenAndServe(*source_addr, nil))
}

0 comments on commit 90b47f0

Please sign in to comment.