diff --git a/base/web/serve.go b/base/web/serve.go index cffe151c..719e40c2 100644 --- a/base/web/serve.go +++ b/base/web/serve.go @@ -95,7 +95,7 @@ func _serve_static(msg *ice.Message, w http.ResponseWriter, r *http.Request) boo } func _serve_handle(key string, cmd *ice.Command, m *ice.Message, w http.ResponseWriter, r *http.Request) { debug := strings.Contains(r.URL.String(), "debug=true") || strings.Contains(r.Header.Get(html.Referer), "debug=true") - m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID), ice.MSG_LANGUAGE, "") + m.Options(ice.LOG_TRACEID, r.Header.Get(ice.LOG_TRACEID)) _log := func(level string, arg ...ice.Any) *ice.Message { if debug || arg[0] == ice.MSG_CMDS { return m.Logs(strings.Title(level), arg...) @@ -167,6 +167,11 @@ func _serve_domain(m *ice.Message) string { } func _serve_auth(m *ice.Message, key string, cmds []string, w http.ResponseWriter, r *http.Request) ([]string, bool) { kit.If(len(cmds) > 0, func() { cmds = append(kit.Split(cmds[0], ","), cmds[1:]...) }) + defer func() { + kit.For(m.Optionv(""), func(key string) { + kit.If(strings.HasPrefix(key, ice.MSG_SESSID), func() { m.Set(ice.MSG_OPTION, key) }) + }) + }() if r.URL.Path == PP(SPACE) { aaa.SessCheck(m, m.Option(ice.MSG_SESSID)) return cmds, true diff --git a/base/web/web.go b/base/web/web.go index e0700737..ce8cfe6d 100644 --- a/base/web/web.go +++ b/base/web/web.go @@ -29,6 +29,7 @@ func (f *Frame) Begin(m *ice.Message, arg ...string) {} func (f *Frame) Start(m *ice.Message, arg ...string) { f.Message, f.Server = m, &http.Server{Handler: f} list := map[*ice.Context]string{} + m.Options(ice.MSG_LANGUAGE, "") m.Travel(func(p *ice.Context, c *ice.Context) { f, ok := c.Server().(*Frame) if !ok || f.ServeMux != nil { diff --git a/meta.go b/meta.go index 7ac2948f..ab1c90f7 100644 --- a/meta.go +++ b/meta.go @@ -21,6 +21,18 @@ func (m *Message) Set(key string, arg ...string) *Message { } else if len(arg) > 0 { if m.delete(arg[0]); len(arg) > 1 { m.value(arg[0], arg[1:]...) + } else { + list := m.value(key) + for i, k := range list { + if k == arg[0] { + for ; i < len(list)-1; i++ { + list[i] = list[i+1] + } + list = list[:len(list)-1] + m.value(key, list...) + break + } + } } } else { kit.For(m.value(key), func(k string) { m.delete(k) })