ws: fixed bug in ws codes and now it worked

This commit is contained in:
nadoo committed 2018-07-22 18:21:27 +08:00
1 parent 9856f943ad
commit ff1fb8c291
6 files changed
+61 -56

No files matched your search

+6 -6
View File
@@ -118,14 +118,14 @@ func (s *HTTP) Serve(c net.Conn) {
// tell the remote server not to keep alive
reqHeader.Set("Connection", "close")
url, err := url.ParseRequestURI(requestURI)
u, err := url.ParseRequestURI(requestURI)
if err != nil {
log.F("[http] parse request url error: %s", err)
return
}
var tgt = url.Host
if !strings.Contains(url.Host, ":") {
var tgt = u.Host
if !strings.Contains(u.Host, ":") {
tgt += ":80"
}
@@ -139,9 +139,9 @@ func (s *HTTP) Serve(c net.Conn) {
// GET http://example.com/a/index.htm HTTP/1.1 -->
// GET /a/index.htm HTTP/1.1
url.Scheme = ""
url.Host = ""
uri := url.String()
u.Scheme = ""
u.Host = ""
uri := u.String()
var reqBuf bytes.Buffer
writeFirstLine(method, uri, proto, &reqBuf)