Skip to content

Commit

Permalink
fixed bug
Browse files Browse the repository at this point in the history
  • Loading branch information
ixqbar committed Dec 31, 2017
1 parent 2fdb7b7 commit 924a49f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/proxy/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Expand Down
12 changes: 10 additions & 2 deletions src/proxy/websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 924a49f

Please sign in to comment.