MCPcopy Create free account
hub / github.com/devfeel/dotweb / GetClientSessionID

Method GetClientSessionID

session/session.go:140–151  ·  view source on GitHub ↗

GetClientSessionID get session id from client default mode is from cookie

(req *http.Request)

Source from the content-addressed store, hash-verified

138// GetClientSessionID get session id from client
139// default mode is from cookie
140func (manager *SessionManager) GetClientSessionID(req *http.Request) (string, error) {
141 cookie, err := req.Cookie(manager.storeConfig.CookieName)
142 if err != nil {
143 return "", err
144 }
145 if cookie.Value == "" {
146 return "", nil
147 }
148 // TODO: check client validity
149 // check ip & agent
150 return url.QueryUnescape(cookie.Value)
151}
152
153func (manager *SessionManager) GetSessionState(sessionId string) (session *SessionState, err error) {
154 session, err = manager.store.SessionRead(sessionId)

Callers 1

prepareHttpContextFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected