inital commit
This commit is contained in:
30
webserverBasicTest/srvdublearg.go
Normal file
30
webserverBasicTest/srvdublearg.go
Normal file
@@ -0,0 +1,30 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io"
|
||||
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", http.NotFound)
|
||||
http.HandleFunc("/runtest", func(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.URL.Query().Get("id")
|
||||
redir := r.URL.Query().Get("redir")
|
||||
fmt.Println("id =>", id)
|
||||
fmt.Println("redir =>", redir)
|
||||
|
||||
if (len(id) < 1 || len(redir) < 1) {
|
||||
io.WriteString(w, "Missing arguments\n")
|
||||
}else {
|
||||
io.WriteString(w, "<script>location.replace(\"")
|
||||
io.WriteString(w, redir)
|
||||
io.WriteString(w, "\")</script>")
|
||||
fmt.Println("Running tasks")
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
http.ListenAndServe("127.0.0.1:5000", nil)
|
||||
}
|
||||
26
webserverBasicTest/srvsinglearg.go
Normal file
26
webserverBasicTest/srvsinglearg.go
Normal file
@@ -0,0 +1,26 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"net/http"
|
||||
"io"
|
||||
|
||||
)
|
||||
|
||||
func main() {
|
||||
http.HandleFunc("/", http.NotFound)
|
||||
http.HandleFunc("/runtest", func(w http.ResponseWriter, r *http.Request) {
|
||||
id := r.URL.Query().Get("id")
|
||||
fmt.Println("id =>", id)
|
||||
|
||||
if (len(id) < 1) {
|
||||
io.WriteString(w, "Missing arguments\n")
|
||||
}else {
|
||||
io.WriteString(w, "id :")
|
||||
io.WriteString(w, id)
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
http.ListenAndServe("127.0.0.1:5000", nil)
|
||||
}
|
||||
Reference in New Issue
Block a user