File upload issue using http::geturl in Tcl contain http-2.9 package
Closed / Fixedf81beca7afabb3d2d395bd979607eda184622f7aCreated 7 years agoUpdated 4 years ago
Descriptionplain2019-07-10 10:24:29
I am using http::geturl to POST a Binary file using these command
set fid [open $filename RDONLY] fconfigure $fid -buffering full -encoding binary -translation binary
::http::geturl {http://10.39.51.221:11009/api/v1/sessions/1/ixnetwork/files?filename=test} -type application/octet-stream -querychannel $fid -binary true -headers {X-Api-Key 00000000000000000000000000000000 IxNetwork-Lib {IxNetwork tcl client v.IXTCLPROTOCOLVERSION} Host 10.39.51.221} -timeout 180000
This code was working properly against Tcl-8.6 (patchlevel-8.6.6) with http-2.8.9.
But client got hang when use the same code against against same Tcl-8.6 (patchlevel-8.6.6) with different http package (http-2.9)
I feel this behavior change due to this chain-list https://github.com/tcltk/tcl/commit/44c0faddc48420a1fd864d75ab6cb3c7ecbf577f?diff=split
earlier -translation was set only as binary (http-2.8.9)
fconfigure $state(-querychannel) -blocking 1 -translation binary
whereas currently -translation also pull from socket (http-2.9)
lassign [fconfigure $sock -translation] trRead trWrite fconfigure $state(-querychannel) -blocking 1 \ -translation [list $trRead binary]
Same code is working properly when reverted to (fconfigure $state(-querychannel) -blocking 1 -translation binary) in http-2.9 code base
kjnashplain2019-07-11 14:16:42
Thank you for your report and workaround/fix. The tracker will not let me change the "Assigned To" field to myself, but I will attempt to process your report.
kjnashplain2019-07-14 09:15:18
Hi Alakendu, Yes, the change that you have pinpointed was a mistake. Thank you for locating it so precisely. The purpose of the changeset was to modify the read and write halves of [fconfigure $sock -translation] independently, because HTTP/1.1 pipelining allows a new HTTP request to be made before the previous HTTP response has completed. When a read or write operation needs to change its value of -translation for $sock, it must not change the value for the other half of the channel. The properties of $querychannel do not need changing. Although the fix is small, I have created a branch bug-f81beca7af to facilitate testing. Best wishes, Keith.
alakenduhtml2019-07-17 09:31:31
Thanks Keith for your valuable support!
dgpplain2020-12-28 13:30:16
Looks like this was fixed in http 2.9.2. Any reason not to close the ticket?
kjnash Closed ticket [f81beca7af].
[History diff]2020-12-31 15:11:03
anonymousplain2021-01-28 19:44:47
installed 2.9.5 and issue is still not fixed, when will this fix be integrated?
anonymous Pending ticket [f81beca7af].
[History diff]2021-01-28 19:45:29
kjnash Closed ticket [f81beca7af].
[History diff]2022-09-11 17:03:32
Log in (anonymous is fine) to add a comment.