forked from quic-go/quic-go
Merge pull request #2495 from lucas-clemente/interop-logging
improve logging in interop client and server
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
|||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
"net"
|
"net"
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
@@ -38,6 +39,8 @@ func (r *RoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
|
|||||||
return nil, errors.New("only GET requests supported")
|
return nil, errors.New("only GET requests supported")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.Printf("Requesting %s.\n", req.URL)
|
||||||
|
|
||||||
r.mutex.Lock()
|
r.mutex.Lock()
|
||||||
hostname := authorityAddr("https", hostnameFromRequest(req))
|
hostname := authorityAddr("https", hostnameFromRequest(req))
|
||||||
if r.clients == nil {
|
if r.clients == nil {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ func (s *Server) handleConn(sess quic.Session) {
|
|||||||
}
|
}
|
||||||
go func() {
|
go func() {
|
||||||
if err := s.handleStream(str); err != nil {
|
if err := s.handleStream(str); err != nil {
|
||||||
log.Printf("Handling stream failed: %s", err.Error())
|
log.Printf("Handling stream failed: %s\n", err.Error())
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
@@ -109,6 +109,9 @@ func (s *Server) handleStream(str quic.Stream) error {
|
|||||||
request := string(reqBytes)
|
request := string(reqBytes)
|
||||||
request = strings.TrimRight(request, "\r\n")
|
request = strings.TrimRight(request, "\r\n")
|
||||||
request = strings.TrimRight(request, " ")
|
request = strings.TrimRight(request, " ")
|
||||||
|
|
||||||
|
log.Printf("Received request: %s\n", request)
|
||||||
|
|
||||||
if request[:5] != "GET /" {
|
if request[:5] != "GET /" {
|
||||||
str.CancelWrite(42)
|
str.CancelWrite(42)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ func GetQLOGWriter() (func(connID []byte) io.WriteCloser, error) {
|
|||||||
log.Printf("Failed to create qlog file %s: %s", path, err.Error())
|
log.Printf("Failed to create qlog file %s: %s", path, err.Error())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
log.Printf("Created qlog file: %s\n", path)
|
||||||
return utils.NewBufferedWriteCloser(bufio.NewWriter(f), f)
|
return utils.NewBufferedWriteCloser(bufio.NewWriter(f), f)
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user