Esempio n. 1
0
// TODO
func rootRedirect(w http.ResponseWriter, r *http.Request) {
	if r.URL.Path == "/" {
		http_util.Redirect(w, r, "/vsafe/home")
	} else {
		http_util.Error(w, http.StatusNotFound)
	}
}
Esempio n. 2
0
func (h pollHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	r.ParseForm()
	keyId, _ := strconv.ParseInt(r.Form.Get("kid"), 10, 64)
	user, key, err := authorizeSession(r, kPollingStore)
	if err == errNotLoggedIn {
		http_util.Error(w, 401)
		return
	}
	if err != nil {
		http_util.ReportError(w, "Error reading database.", err)
		return
	}
	logging.SetUserName(r, user.Name)
	if keyId != key.Id {
		http_util.Error(w, 401)
		return
	}
	http_util.Error(w, 200)
}