diff options
author | sandeep <sandeep@noemail.net> | 2000-03-19 22:32:25 (GMT) |
---|---|---|
committer | sandeep <sandeep@noemail.net> | 2000-03-19 22:32:25 (GMT) |
commit | 59d736852dbaa8e246acce0fa47843f9161d11f3 (patch) | |
tree | 13ce9084d6c41a10a178d38efb3ce76757fc4f2d /tests | |
parent | 583d0541a92a8a8d6ec009fe23b6dd329c86f2f8 (diff) | |
download | tcl-59d736852dbaa8e246acce0fa47843f9161d11f3.zip tcl-59d736852dbaa8e246acce0fa47843f9161d11f3.tar.gz tcl-59d736852dbaa8e246acce0fa47843f9161d11f3.tar.bz2 |
* library/http2.1/http.tcl: Added -querychannel option and altered
some of Brent's modifications to allow asynchronous posts (via
-command). Also modified -queryprogress so that it calls the
query callback as <callback> <token> <total size> <current size>
to be consistent with -progress. Added -queryblocksize option
with default 8192 bytes for post blocksize. Fixed a bunch of
potential memory leaks for the case when geturl receives bad args
or can't open a socket, etc. Overall, the package really rocks
now.
* doc/http.n: Added -queryblocksize, -querychannel, and
-queryprogress. Also, changed the description of -blocksize,
which states that the -progress callback will be called for each
block, to now qualify that with an "if -progress is specified".
* tests/http.test: Added a querychannel test for synchronous and
asynchronous posts, altered the queryprogress test such that the
callback conforms to the -progress format. Also, had to use the
-queryblocksize option to do the post 16K at a time to match
Brent's expected results (and to test that -queryblocksize works).
FossilOrigin-Name: aadf3c36fecf2456f03b8f5d9fbea4ca969ad267
Diffstat (limited to 'tests')
-rw-r--r-- | tests/http.test | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/tests/http.test b/tests/http.test index af231d7..c242ae0 100644 --- a/tests/http.test +++ b/tests/http.test @@ -12,7 +12,7 @@ # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # # -# RCS: @(#) $Id: http.test,v 1.15 2000/03/17 02:15:18 welch Exp $ +# RCS: @(#) $Id: http.test,v 1.16 2000/03/19 22:32:26 sandeep Exp $ if {[lsearch [namespace children] ::tcltest] == -1} { package require tcltest @@ -194,14 +194,48 @@ test http-3.10 {http::geturl queryprogress} { proc postProgress {token x y} { global postProgress - lappend postProgress $x + lappend postProgress $y } set postProgress {} set t [http::geturl $posturl -query $query \ - -queryprogress postProgress] + -queryprogress postProgress -queryblocksize 16384] http::wait $t list [http::status $t] [string length $query] $postProgress [http::data $t] -} {ok 122879 {16384 32768 49152 65536 81920 98304 114688 131072} {Got 122879 bytes}} +} {ok 122879 {16384 32768 49152 65536 81920 98304 114688 122879} {Got 122879 bytes}} + +test http-3.11 {http::geturl querychannel with -command} { + set query foo=bar + set sep "" + set i 0 + # Create about 120K of query data + while {$i < 14} { + incr i + append query $sep$query + set sep & + } + ::tcltest::makeFile $query outdata + set fp [open outdata] + + proc asyncCB {token} { + global postResult + lappend postResult [http::data $token] + } + set postResult [list ] + set t [http::geturl $posturl -querychannel $fp] + http::wait $t + set testRes [list [http::status $t] [string length $query] [http::data $t]] + + # Now do async + http::cleanup $t + close $fp + set fp [open outdata] + set t [http::geturl $posturl -querychannel $fp -command asyncCB] + set postResult [list PostStart] + http::wait $t + + lappend testRes [http::status $t] $postResult + set testRes +} {ok 122879 {Got 122880 bytes} ok {PostStart {Got 122880 bytes}}} test http-4.1 {http::Event} { |