Changes On Branch bug-2641672
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Changes In Branch bug-2641672 Excluding Merge-Ins

This is equivalent to a diff from ffca918442 to e6634132e3

2022-09-06
09:06
closes [2641672fff] - resolved timing sensitivity of httpold-4.12 and speed-up all httpd depending t... check-in: aaa3de736b user: sebres tags: core-8-6-branch
2022-09-05
10:30
closes [2641672fff], httpd - don't parse delay argument by error 400 (wrong URI/proto) Closed-Leaf check-in: e6634132e3 user: sebres tags: bug-2641672
2022-09-03
13:57
typo's check-in: 15bb2e6c98 user: jan.nijtmans tags: core-8-6-branch
2022-09-02
17:17
amend to [2641672fff], guarantees a delay to cause a timeout definitely + switch delay-argument from... check-in: 8499001878 user: sebres tags: bug-2641672
17:02
really closes [2641672fff] - resolved timing sensitivity of httpold-4.12 and speed-up all httpd depe... check-in: 6ac843c97f user: sebres tags: bug-2641672
14:13
Merge 8.6 check-in: f6f80b73cc user: jan.nijtmans tags: core-8-branch
14:11
Mark httpold-4.12 knownBug. See [2641672]: http1.0 failing test: httpold-4.12 check-in: ffca918442 user: jan.nijtmans tags: core-8-6-branch
13:54
Fix [95b6a1747a]: Eval.3 docu fix check-in: 20d56e734c user: jan.nijtmans tags: core-8-6-branch

Changes to tests/httpd.
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66




67
68
69
70
71
72
73
proc httpdAccept {newsock ipaddr port} {
    global httpd
    upvar #0 httpd$newsock data

    fconfigure $newsock -blocking 0 -translation {auto crlf}
    httpd_log $newsock Connect $ipaddr $port
    set data(ipaddr) $ipaddr
    after 50 [list fileevent $newsock readable [list httpdRead $newsock]]
}

# read data from a client request

proc httpdRead { sock } {
    upvar #0 httpd$sock data

    if {[eof $sock]} {
	set readCount -1
    } elseif {![info exists data(state)]} {

	# Read the protocol line and parse out the URL and query

	set readCount [gets $sock line]
	if {[regexp {(POST|GET|HEAD) ([^?]+)\??([^ ]*) HTTP/(1.[01])} $line \
		-> data(proto) data(url) data(query) data(httpversion)]} {
	    set data(state) mime
	    httpd_log $sock Query $line




	} else {
	    httpdError $sock 400
	    httpd_log $sock Error "bad first line:$line"
	    httpdSockDone $sock
	}
	return
    } elseif {$data(state) == "mime"} {







|


















>
>
>
>







41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
proc httpdAccept {newsock ipaddr port} {
    global httpd
    upvar #0 httpd$newsock data

    fconfigure $newsock -blocking 0 -translation {auto crlf}
    httpd_log $newsock Connect $ipaddr $port
    set data(ipaddr) $ipaddr
    fileevent $newsock readable [list httpdRead $newsock]
}

# read data from a client request

proc httpdRead { sock } {
    upvar #0 httpd$sock data

    if {[eof $sock]} {
	set readCount -1
    } elseif {![info exists data(state)]} {

	# Read the protocol line and parse out the URL and query

	set readCount [gets $sock line]
	if {[regexp {(POST|GET|HEAD) ([^?]+)\??([^ ]*) HTTP/(1.[01])} $line \
		-> data(proto) data(url) data(query) data(httpversion)]} {
	    set data(state) mime
	    httpd_log $sock Query $line
	    if {[regexp {(?:^|[\?&])delay=([^&]+)} $data(query) {} val]} {
		fileevent $sock readable {}
		after $val [list fileevent $sock readable [list httpdRead $sock]]
	    }
	} else {
	    httpdError $sock 400
	    httpd_log $sock Error "bad first line:$line"
	    httpdSockDone $sock
	}
	return
    } elseif {$data(state) == "mime"} {
Changes to tests/httpold.test.
252
253
254
255
256
257
258
259

260
261
262
263


264

265




266
267
268
269
270
271
272
273
    http_size $token
} {111}
test httpold-4.11 {httpEvent} {
    set token [http_get $url -timeout 1 -command {#}]
    http_reset $token
    http_status $token
} {reset}
test httpold-4.12 {httpEvent See [2641672]} knownBug {

    update
    set x {}
    after 500 {lappend x ok}
    set token [http_get $url -timeout 1 -command {lappend x fail}]


    vwait x

    list [http_status $token] $x




} {timeout ok}

test httpold-5.1 {http_formatQuery} {
    http_formatQuery name1 value1 name2 "value two"
} {name1=value1&name2=value+two}

test httpold-5.2 {http_formatQuery} {
    http_formatQuery name1 ~bwelch name2 \xa1\xa2\xa2







|
>


<
|
>
>
|
>
|
>
>
>
>
|







252
253
254
255
256
257
258
259
260
261
262

263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
    http_size $token
} {111}
test httpold-4.11 {httpEvent} {
    set token [http_get $url -timeout 1 -command {#}]
    http_reset $token
    http_status $token
} {reset}
test httpold-4.12 {httpEvent} -body {
    set tout {}
    update
    set x {}

    set token [http_get $url?delay=500 -timeout 1 -command {lappend x fail}]
    set i 0; while {$x eq {} && [incr i] < 50} {
	set tout [after 20 {set x progress}]
	vwait x
	if {$x ne "progress"} break
	set x [http_status $token]
    }
    set x
} -cleanup {
    if {$tout ne {}} {after cancel $tout}
} -result timeout

test httpold-5.1 {http_formatQuery} {
    http_formatQuery name1 value1 name2 "value two"
} {name1=value1&name2=value+two}

test httpold-5.2 {http_formatQuery} {
    http_formatQuery name1 ~bwelch name2 \xa1\xa2\xa2