Jeff, I have ns_http working, at least for me here with binary data. Supposedly this is the reason for ns_http (not ns_httpget/post or ns_httpsget/post):
Here is a script: set id [ns_http queue http://192.168.1.102:8000/sns-thumb.jpg] set ok [ns_http wait -result image -status status $id] if {"$status" == "200"} { set fd [open [file join [file dirname [info script]] myimage.jpg] w+] } else { ns_return $status text/html $image return -code return } # Very important: fconfigure $fd -translation binary puts $fd $image close $fd ns_return $status text/html "Status: $status <br> <a href=\"/myimage.jpg\">My Image</a>" On Monday 22 October 2007 18:08, Jeff Rogers wrote: > Dossy Shiobara wrote: > >> What I'm struggling with though is if I store an image file to the > >> sob with sob.copy and then try and retrieve it later with nsob.get, > >> it only returns the first 4 or 10 bytes of the file. > > > > SOB isn't encoding-aware and is actually really naive--it doesn't handle > > binary data well. > > Not sure if this it related, but I was just looking at ns_http for an > unrelated purpose and it appears that it is not binary clean at all, > since it uses Tcl_SetVar which expects a null-terminated string. > Getting binary files typically resulted in a 4 byte response, could be > that an average jpg file has a null at byte 4. > > -J > > > -- > AOLserver - http://www.aolserver.com/ > > To Remove yourself from this list, simply send an email to > <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the > email message. You can leave the Subject: field of your email blank. -- AOLserver - http://www.aolserver.com/ To Remove yourself from this list, simply send an email to <[EMAIL PROTECTED]> with the body of "SIGNOFF AOLSERVER" in the email message. You can leave the Subject: field of your email blank.
