Tcl Source Code

View Ticket
Bounty program for improvements to Tcl and certain Tcl packages.
10:03 Closed ticket [2a94652ee1]: http package reply "100 continue" code broken plus 7 other changes artifact: c48bc09b6f user: oehhar
http state 100 continue handling broken [2a94652ee1] check-in: d6bb682808 user: oehhar tags: novem
http state 100 continue handling broken [2a94652ee1] check-in: 79053036d8 user: oehhar tags: trunk
http state 100 continue handling broken [2a94652ee1] check-in: fb94c24691 user: oehhar tags: core-8-6-branch
08:56 Ticket [2a94652ee1] http package reply "100 continue" code broken status still Pending with 3 other changes artifact: f2a5e11e9c user: jan.nijtmans
06:35 Pending ticket [2a94652ee1]. artifact: f9eca365ce user: oehhar
http state 100 continue handling broken [2a94652ee1] Closed-Leaf check-in: b80bf5033f user: oehhar tags: bug-2a94652ee1
14:23 New ticket [2a94652ee1] http package reply "100 continue" code broken. artifact: e80865243f user: oehhar

Ticket UUID: 2a94652ee10cae20c0b54cf9fd6516eb01daadd5
Title: http package reply "100 continue" code broken
Type: Bug Version: 8.6.7
Submitter: oehhar Created on: 2017-08-30 14:23:17
Subsystem: 29. http Package Assigned To: oehhar
Priority: 5 Medium Severity: Critical
Status: Closed Last Modified: 2017-08-31 10:03:56
Resolution: Fixed Closed By: oehhar
    Closed on: 2017-08-31 10:03:56

http 2.8.11 package does not correctly ignore "100 Continue" replies. The relevant code is broken.

What happens?

The first line of a web server reply contains the status. If this is:

HTTP/1.1 100 Contine
the real header will follow as a following line.

The current code correctly ignores the continue status, but does not expect a following status line.

The insertion of a set to state "connecting" fixes that (around line 1034):

proc http::Event {sock token} {
	    # We ignore HTTP/1.1 100 Continue returns. RFC2616 sec 8.2.3
	    if {$state(http) == "" || ([regexp {^\S+\s(\d+)} $state(http) {} x] && $x == 100)} {
		set state(state) "connecting"

At least, inserting this line cured the communication for me with TCLWS and a .net server.

User Comments: oehhar added on 2017-08-31 10:03:56:

Ok, committed to all branches.

Thank you !

jan.nijtmans added on 2017-08-31 08:56:30:
Well, I cannot find anything wrong with it. So, just go ahead (with merging to core-8-6-branch -> trunk -> novem)! Thanks!

oehhar added on 2017-08-31 06:35:22:

Branch [bug-2a94652ee1] with commit [b80bf5033f] inserts the proposed line and increses the version number of the http number.

I would appreciate a review before merge or just a merge.

The fix is IMHO ok and works well for me. The review is mor for formal issues like version number increment and targeting branches.