diff --git a/src/proxy/client.go b/src/proxy/client.go index 76c0920..a32693f 100644 --- a/src/proxy/client.go +++ b/src/proxy/client.go @@ -33,9 +33,9 @@ func (obj *Client) Close() { <- obj.over } -func (obj *Client) remove() { +func (obj *Client) Remove() { if obj.alive { - obj.Close() + go obj.Close() } obj.over <- true @@ -80,7 +80,7 @@ func (obj *RequestClients) RemoveClient(uuid string) { obj.Lock() defer obj.Unlock() - obj.Clients[uuid].remove() + obj.Clients[uuid].Remove() obj.num-- delete(obj.Clients, uuid) } diff --git a/src/proxy/websocket.go b/src/proxy/websocket.go index 9578823..d01a1ad 100644 --- a/src/proxy/websocket.go +++ b/src/proxy/websocket.go @@ -60,10 +60,18 @@ func proxyHttpHandle(w http.ResponseWriter, r *http.Request) { Logger.Printf("client %s[%s] disconnected", conn.RemoteAddr(), clientUUID) }() + qstr := r.URL.RawQuery + if len(qstr) == 0 { + qstr = Config.QueryString + } else { + qstr = fmt.Sprintf("%s&%s", qstr, Config.QueryString) + } + + Logger.Printf("client %s[%s] final query[%s]", conn.RemoteAddr(), clientUUID, qstr) env := make(map[string]string) env["SCRIPT_FILENAME"] = Config.ScriptFileName - env["QUERY_STRING"] = Config.QueryString + env["QUERY_STRING"] = qstr for _, item := range Config.HeaderParams { env[item.Key] = item.Value @@ -80,7 +88,7 @@ func proxyHttpHandle(w http.ResponseWriter, r *http.Request) { for { messageType, p, err := conn.ReadMessage() if err != nil { - Logger.Printf("client %s[%s] read err message failed %s", conn.RemoteAddr(),clientUUID, err) + Logger.Printf("client %s[%s] read err message failed %s", conn.RemoteAddr(), clientUUID, err) break }