Support Requests item #428042, was updated on 2001-05-28 13:10
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=203152&aid=428042&group_id=3152
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: klaus momberger (klaus_momberger)
Assigned to: Nobody/Anonymous (nobody)
Summary: fetching and reserving images
Initial Comment:
I would like to use aolserver as some kind of proxy,
fetch a page from another webserver using ns_httpget
and return it, using ns_return or ns_write.
While this works fine for html, it fails for images.
The reason seems to be that the TCL API does not
properly support binary data.
Any advice will be appreciated,
regards,
-Klaus Momberger.
----------------------------------------------------------------------
>Comment By: Dossy Shiobara (dossy)
Date: 2001-05-30 07:53
Message:
Logged In: YES
user_id=21885
The Tcl8 API does support binary data. However, the
AOLserver internals may or may not. I've noticed the same
thing you have and here is the work-around that I've used:
1) Create a temporary file
2) Write your binary content to it
3) Return the file
4) Remove the file
Here's some sample code that may work with some
modification:
set f [ns_mktemp /tmp/file_XXXXXX]
set fd [open $f w+]
puts -nonewline $fd $content
close $fd
ns_respond -status 200 -type $content_type -file $f
ns_unlink $f
The binary content is contained in variable $content, and
the MIME type for the content is in variable $content_type.
Is this a suitable solution to your problem? -- Dossy
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=203152&aid=428042&group_id=3152