1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-24 04:15:56 +00:00

Add an example for httprouter_test, gofmt everything and misspel fixes.

Former-commit-id: e69ffdf9bba4c7e8c3df45c015b3363cc3fc59b6
This commit is contained in:
Gerasimos (Makis) Maropoulos
2017-02-17 10:45:47 +02:00
parent 2eae027e77
commit 9a3c4f4c0a
13 changed files with 307 additions and 19 deletions

View File

@@ -55,7 +55,7 @@ func RemoveCookie(name string, res http.ResponseWriter, req *http.Request) {
// valid means that is recognised as 'domain' by the browser, so it(the cookie) can be shared with subdomains also
func IsValidCookieDomain(domain string) bool {
if domain == "0.0.0.0" || domain == "127.0.0.1" {
// for these type of hosts, we can't allow subdomains persistance,
// for these type of hosts, we can't allow subdomains persistence,
// the web browser doesn't understand the mysubdomain.0.0.0.0 and mysubdomain.127.0.0.1 mysubdomain.32.196.56.181. as scorrectly ubdomains because of the many dots
// so don't set a cookie domain here, let browser handle this
return false

View File

@@ -32,15 +32,17 @@ func (d *Database) Load(sid string) map[string]interface{} {
if err != nil {
if err != nil {
// don't use to get the logger, just prin these to the console... atm
println("Redis Connection error on Connect: " + err.Error())
println("But don't panic, auto-switching to memory store right now!")
///TODO: Find a way to use the iris' defined logger via an optional interface to Database.
// println("Redis Connection error on Connect: " + err.Error())
// println("But don't panic, auto-switching to memory store right now!")
}
}
}
//fetch the values from this session id and copy-> store them
val, err := d.redis.GetBytes(sid)
if err == nil {
err = DeserializeBytes(val, &values)
// err removed because of previous TODO
DeserializeBytes(val, &values)
}
return values

View File

@@ -125,7 +125,7 @@ func (s *sessions) Start(res http.ResponseWriter, req *http.Request) iris.Sessio
}
}
// finally set the .localhost.com (for(1-level) || .mysubdomain.localhost.com (for 2-level subdomain allow)
cookie.Domain = "." + requestDomain // . to allow persistance
cookie.Domain = "." + requestDomain // . to allow persistence
}
}