#4305 newer http prevents connection

obsolete: 8.5.6
closed-fixed
Pat Thoyts
9
2009-04-10
2009-02-21
Sander Hoentjen
No

I seem to be having a problem with http 2.7.2
with it, amsn doesn't connect
If i revert the change from http://tcl.cvs.sourceforge.net/viewvc/tcl/tcl/library/http/http.tcl?r1=1.71&r2=1.72&pathrev=MAIN between line 1026 and 1027 it works again.
A puts on $line gives me:
HTTP/1.1 200 OK
HTTP/1.1 200 OK

This is with amsn 0.97.2

P.S. with amsn latest svn there is a different bug when used with http 2.7.2, if I have time I will try to investigate that one also.

Discussion

  • Don Porter
    Don Porter
    2009-02-21

    • labels: --> 29. http Package
    • assigned_to: nobody --> patthoyts
    • milestone: --> obsolete: 8.5.6
    • priority: 5 --> 9
     
  • I just found out the bug with amsn svn is not a different one, it is fixed by the same fix as above:
    # cvs diff -u
    cvs diff: Diffing .
    Index: http.tcl
    ===================================================================
    RCS file: /cvsroot/tcl/tcl/library/http/http.tcl,v
    retrieving revision 1.72
    diff -u -r1.72 http.tcl
    --- http.tcl 23 Oct 2008 23:17:38 -0000 1.72
    +++ http.tcl 23 Feb 2009 18:55:05 -0000
    @@ -1024,6 +1024,8 @@
    }
    }
    lappend state(meta) $key [string trim $value]
    + } elseif {[string match HTTP* $line]} {
    + set state(http) $line
    }
    }
    } else {

     
  • Sergei Golovan
    Sergei Golovan
    2009-03-29

    It seems to me that this bug occurs because ::http::Event procedure switches from "connecting" state too early (before the initial HTTP line is received). The following patch prevents from switching to "header" state if gets returned -1 (though I'm not sure if this patch fixes the bug completely):

    --- http.tcl.orig
    +++ http.tcl
    @@ -943,9 +943,10 @@
    return
    }
    if {$state(state) eq "connecting"} {
    - set state(state) "header"
    if {[catch {gets $sock state(http)} n]} {
    return [Finish $token $n]
    + } elseif {$n >= 0} {
    + set state(state) "header"
    }
    } elseif {$state(state) eq "header"} {
    if {[catch {gets $sock line} n]} {

     
  • Pat, we recently talked about http, and I told you that with http 2.7.2 I got an empty result for some urls (sourceforge xml tracker export). Applying teopetuk's change to my local copy of http 2.7.2 fixed that problem.

     
  • Don Porter
    Don Porter
    2009-04-03

    any prospects for a quick fix on this one?

     
  • Don Porter
    Don Porter
    2009-04-09

    teopetuk patch committed for
    http 2.7.3. Please re-open if
    the problems still show up using
    http 2.7.3.

     
  • Don Porter
    Don Porter
    2009-04-09

    • status: open --> pending-fixed
     
  • Pat Thoyts
    Pat Thoyts
    2009-04-10

    I have made the http tests replicate this fault now by having the test server return the initial HTTP response line in two parts. This shows that the current patch is ok and fixes the fault and will not recurr.

     
  • Pat Thoyts
    Pat Thoyts
    2009-04-10

    • status: pending-fixed --> closed-fixed