Artifacts Associated With Ticket 1096703fffffffffffffffffffffffffffffffff
Ticket change [b5bc7bf31b] (rid 125294) by dvrsn on 2005-01-05 20:19:04:
- assignee initialized to: "hobbs"
- cmimetype initialized to: "text/plain"
- comment initialized to:
Not sure if this belongs here or in tcllib, but since http is part of the core I would think here. It is possible to post a mime message (the primary one of interest would be a multipart/form-data post) using http, but it is more complicated than it should be. Suggested functionality: test the -query argument to http::geturl, if it is determined to be a mime token (produced by the mime package in tcllib) then use that to set the content-type and associated information (such as boundary) and extract the message from that token. Alternately use a -mime argument to unambiguously invoke this functionality. This probably requires additional support from the tcllib mime package, particularly a way to query the boundary string separately from the entire message.
- foundin initialized to: "None"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "dvrsn"
- subsystem initialized to: "29. http Package"
- title initialized to: "add mime support to http"
- type initialized to: "RFE"
Ticket change [b52f0f999a] (rid 125195) by davidw on 2005-01-27 00:00:35:
- icomment:
Logged In: YES user_id=240 I created the following helper functions (change the namespace if you want to use them), which work with http as it stands now. It would probably be better to create a -multipart switch for geturl, as it would be simpler. proc multipload::multipart-var {var val} { return "Content-Disposition: form-data; name=\"$var\";\r\n\r\n${val}\r\n" } proc multipload::multipart-file {var filename} { set fl [open $filename r] fconfigure $fl -translation binary set data [read $fl] close $fl return "Content-Disposition: form-data; name=\"${var}\"; filename=\"${filename}\"\r\n\r\n$data\n" } proc multipload::multipart/form-data {queryvarname boundvarname parts} { upvar $queryvarname query upvar $boundvarname bound set bound "-----NEXT_PART_[clock seconds].[pid]" set result [join $parts "--${bound}\r\n"] set result "--${bound}\r\n${result}--${bound}--" set query $result } You can use them like so: multipart/form-data query bound [list [multipart-file fileupload $filename] \ [multipart-var action upload]] set page [::http::geturl $url -type "multipart/form-data; boundary=$bound" \ -query $query] Hope the formatting isn't too bad with SF... - login: "davidw"
- mimetype: "text/plain"
- username: "davidw"
- icomment:
Ticket change [eb0151f4a1] (rid 103465) by hobbs on 2008-03-12 16:41:58:
- closedate changed to: "2008-03-12T09:41:58"
- closer changed to: "hobbs"
- icomment:
Logged In: YES user_id=72656 Originator: NO This looks very appropriate for tcllib.
- login: "hobbs"
- mimetype: "text/plain"
- resolution changed to: "Rejected"
- status changed to: "Closed"
- username: "hobbs"