| @@ -5,6 +5,7 @@ import ( | |||
| "encoding/json" | |||
| "errors" | |||
| "fmt" | |||
| "log" | |||
| "math/rand" | |||
| "net/http" | |||
| "net/url" | |||
| @@ -20,7 +21,8 @@ func crmpixelImage() (pixel []byte, err error) { | |||
| } | |||
| func crmpixel(w http.ResponseWriter, r *http.Request) { | |||
| //log.Println("a") | |||
| log.Println(getHTTPRequestQuery(r, "abc")) | |||
| cookie := crmpixelCookie(r) | |||
| http.SetCookie(w, &cookie) | |||
| @@ -310,3 +310,13 @@ func response404Handler(w http.ResponseWriter) { | |||
| w.WriteHeader(http.StatusNotFound) | |||
| fmt.Fprintf(w, "not found") | |||
| } | |||
| func getHTTPRequestQuery(r *http.Request, name string) (value string) { | |||
| rq := r.URL.RawQuery | |||
| m, _ := url.ParseQuery(rq) | |||
| v, ok := m[name] | |||
| if ok { | |||
| value = v[0] | |||
| } | |||
| return | |||
| } | |||