Server delivering binary content
We're looking to replace a set of CGI programs with equivalent .nxscript applications. One of these programs is an 'image server', which delivers a dynamically sized version of an image file.
The NexusDb web server component (at least the version we are working with - 4.5003) is currently designed only to deliver a textual response. I have managed to hack it to the point where it will deliver images, but the result isn't pretty.
Essentially I have added a socStream property to the nxllSimpleOutputCache, and changed the SaveToFile procedure so that it outputs this stream if it is instantiated, rather than outputting any text that might have been pushed to the output cache. I also needed to specify the response content type. I can set this in the script:
but I also needed to add code so that this setting is respected, and not overwritten in the ProcessRequest procedure:
if (GetVar('response-content-type') <> '') then
fReplyHeaders.Add('Content-type: '+ctype+'; charset=UTF-8');
However, if you're returning a binary response, the content type ought to reflect this without needing to be specified in your script.
Before I proceed to make larger-scale changes to the code, I thought I would check in with this group. Has anyone else attempted this, or am I on my own?
|Thread||Thread Starter||Forum||Replies||Last Post|
|Nxscript server delivering binary content||RichardLight||nexusdb.public.support||3||6th March 2021 06:51 PM|
|Content Locks and Transactions work||sri.ajay||nexusdb.public.support||12||27th November 2015 07:32 PM|
|New user...How to view content of nx1 files?||gorlaz||nexusdb.public.support||11||15th March 2011 07:12 PM|
|Source Server smaller that Current Binary Release||Chris||nexusdb.public.support||2||9th January 2006 06:28 PM|
|Binary Server||Bernhard Roos||nexusdb.public.support||4||3rd December 2005 10:08 AM|