Commit 44361878 authored by owlo's avatar owlo

map started!

parent a13f1a5f
No preview for this file type
......@@ -449,6 +449,39 @@ func main() {
w.Write(signedContent)
}
})
mux.HandleFunc("/getMap", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
// response. These three headers are actually sent in
// the trailer.
fmt.Println("WHER GOING?")
signed := req.Header.Get("Signature")
// signature := req.Header.Get("Authorization")
signature, err := ioutil.ReadAll(req.Body)
fmt.Println(string(signed))
if err != nil {
fmt.Println(err)
}
ok := validateLogin(signed, []byte(signature), initializedActors)
if ok {
w.Header().Set("Authorization", "ok")
w.WriteHeader(http.StatusOK)
space := ""
for x := 0; x < 240; x++ {
if x != 127 {
space += "X"
} else {
space += "@"
}
}
w.Write([]byte(space))
} else {
w.Header().Set("Authorization", "not authorized")
w.Write([]byte("ennt!"))
}
})
mux.HandleFunc("/examplelogin", func(w http.ResponseWriter, req *http.Request) {
// Before any call to WriteHeader or Write, declare
// the trailers you will set during the HTTP
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment