Overview
| Artifact ID: | 4e2f61f9d9e55d2c009b9b3492093dbcc15b9467 |
|---|---|
| Ticket: | 6a71dbe6ece710a81d6188ff8075ce4d1dc6b89a
http encoding error not brought up |
| User & Date: | oehhar on 2015-05-12 15:58:18 |
Changes
- assignee changed to: "nobody"
- closer changed to: "nobody"
- cmimetype changed to: "text/x-fossil-wiki"
- comment changed to:
As found out by Luc Monier on clt [https://groups.google.com/forum/#!topic/comp.lang.tcl/B6afDJQg8LA], the following http request fails 8.6 and succeeded on 8.5: <verbatim> % package require http 2.8.8 % set organism_name "nipah" nipah % set xml " <?xml version=\"1.0\" encoding=\"UTF-8\"?> <orgPdbQuery> <version>B0905</version> <queryType>org.pdb.query.simple.OrganismQuery</queryType> <description>Organism Search : Organism Name=$organism_name </description> <organismName>$organism_name</organismName> </orgPdbQuery> " % set url "http://www.rcsb.org/pdb/rest/search" % ::http::config -urlencoding utf-8 % set tok [::http::geturl $url -query $xml -type "application/x-www-form-urlencoded"] can't read "coding": no such variable </verbatim> The following patch is a first step to bring up the real error message: <verbatim> --- http-2.8.8.tm +++ http-2.8.9.tm @@ -11,7 +11,7 @@ package require Tcl 8.6 # Keep this in sync with pkgIndex.tcl and with the install directories in # Makefiles -package provide http 2.8.8 +package provide http 2.8.9 namespace eval http { # Allow resourcing to not clobber existing data @@ -1299,7 +1299,7 @@ set state(body) [zlib $coding $state(body)] } } err]} { - Log "error doing $coding '$state(body)'" + Log "error doing coding '$state(body)' : $err" return [Finish $token $err] } </verbatim> If this patch is applied, the output is as follows: <verbatim> ... init as above % proc http::Log args {puts **$args} % set tok [::http::geturl $url -query $xml -type "application/x-www-form-urlencoded"] **{Using sock02E7DC30 for www.rcsb.org:80} {} **{error doing coding '1WP7 2VSM 2VWD 3D11 3D12 3N27 4CO6 4GJW 4N5B ' : unsupported content-encoding "text/plain"} **{Closing socket sock02E7DC30 (no connection info)} </verbatim> Ok, "text/plain" missing in coding tables. Thus patch: <verbatim> @@ -1473,6 +1473,7 @@ gzip - x-gzip { lappend r gunzip } compress - x-compress { lappend r decompress } identity {} + text/plain {} default { return -code error "unsupported content-encoding \"$coding\"" } </verbatim> This gives the desired result: <verbatim> ... init as above % proc http::Log args {puts **$args} % set tok [::http::geturl $url -query $xml -type "application/x-www-form-urlencoded"] **{Using sock02E63980 for www.rcsb.org:80} {} **{Closing socket sock02E63980 (no connection info)} ::http::3 % set rep [::http::data $tok] 1WP7 2VSM 2VWD 3D11 3D12 3N27 4CO6 4GJW 4N5B </verbatim> I am not sure what I am doing. The patch just looks reasonable for the case. Thank you, Harald - foundin changed to: "8.6.4"
- is_private changed to: "0"
- login: "oehhar"
- priority changed to: "5 Medium"
- private_contact changed to: "0f366eb3e9e2fcab52b8ebacd197db9047186a5f"
- resolution changed to: "None"
- severity changed to: "Minor"
- status changed to: "Open"
- submitter changed to: "oehhar"
- subsystem changed to: "29. http Package"
- title changed to: "http encoding error not braught up"
- type changed to: "Bug"