@@ -719,24 +719,15 @@ func (re *remoteConn) doRemote(lo localConn, out *net.Conn, network string, time
719
719
if lo .mode == "H" && re .firstReq != nil {
720
720
firstResp , err = http .ReadResponse (bufOut , re .firstReq )
721
721
ttfb = time .Since (sentTime )
722
- // Continue reading for a short period of time to detect delayed reset
723
- // This is obviously insufficient, need to come up with a better way
724
- if err == nil && route == 1 && ! re .ruleBased {
725
- (* out ).SetReadDeadline (time .Now ().Add (time .Millisecond * 100 ))
726
- _ , err = bufOut .ReadByte ()
727
- if err == nil {
728
- bufOut .UnreadByte ()
729
- }
730
- if err != nil && strings .Contains (err .Error (), "time" ) {
731
- err = nil
732
- }
733
- }
734
722
} else {
735
723
n , err = bufOut .Read (firstIn )
736
724
ttfb = time .Since (sentTime )
725
+ if n > 0 && * verbose {
726
+ logger .Printf ("%s %5d: * %d First %d bytes from server. TTFB %d ms." , lo .mode , lo .total , route , n , ttfb .Milliseconds ())
727
+ }
737
728
// Continue reading for a short period of time to detect delayed reset
738
729
if err == nil && route == 1 && ! re .ruleBased && n > 0 && n < initialSize {
739
- (* out ).SetReadDeadline (time .Now ().Add (time .Millisecond * 100 ))
730
+ (* out ).SetReadDeadline (time .Now ().Add (time .Millisecond * 50 ))
740
731
var n1 int
741
732
n1 , err = io .ReadFull (bufOut , firstIn [n :])
742
733
n += n1
@@ -788,7 +779,6 @@ func (re *remoteConn) doRemote(lo localConn, out *net.Conn, network string, time
788
779
} else {
789
780
// If there is response, remove full flag
790
781
re .firstIsFull = false
791
- // Check response validity
792
782
if lo .mode == "H" && re .firstReq != nil {
793
783
if * verbose {
794
784
logger .Printf ("H %5d: * %d HTTP Status %s Content-length %d. TTFB %d ms." , lo .total , route , firstResp .Status , firstResp .ContentLength , ttfb .Milliseconds ())
@@ -801,9 +791,6 @@ func (re *remoteConn) doRemote(lo localConn, out *net.Conn, network string, time
801
791
return
802
792
}
803
793
} else {
804
- if * verbose {
805
- logger .Printf ("%s %5d: * %d First %d bytes from server. TTFB %d ms." , lo .mode , lo .total , route , n , ttfb .Milliseconds ())
806
- }
807
794
if re .firstReq != nil {
808
795
if resp , err := readResponseStatus (bufio .NewReader (bytes .NewReader (firstIn [:n ]))); err == nil {
809
796
if * verbose {
0 commit comments