CGI GIF output corrupted

 
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI
View previous topic :: View next topic  
Author Message
neptune
-


Joined: 04 Nov 2003
Posts: 2

PostPosted: Tue Nov 04, 2003 2:28 am    Post subject: CGI GIF output corrupted Reply with quote

I have a cgi written in C that dynamically creates a small GIF. It works without any problems under apache on a linux system and most of the time under Abyss on WinXP.
Under Abyss, the output is sometimes corrupted. It seems that Abyss is incorrectly adding 0x0D before every instance of a 0x0A byte for a mime-type of image/gif . Obviously this corrupts the GIF image.

FYI: The cgi is called in html code similar to the following example:
Code:
<img src="ptile.cgi?l=3.5&h=4.6">


The CGI parsed header output is as follows:
Code:
Content-type: image/gif



Am I missing something here?
_________________
Neptune
Back to top View user's profile Send private message
aprelium
-


Joined: 22 Mar 2002
Posts: 6800

PostPosted: Fri Nov 07, 2003 1:42 am    Post subject: Re: CGI GIF output corrupted Reply with quote

Abyss doesn't add any \r or \n. It is the C stdio function that does so on Windows and you should be careful when outputting binary data to stdout.
If you want some help with this issue, please send us your C code to support@aprelium.com and we'll show you how to fix the problem.
_________________
Support Team
Aprelium - http://www.aprelium.com
Back to top View user's profile Send private message Send e-mail
neptune
-


Joined: 04 Nov 2003
Posts: 2

PostPosted: Fri Nov 07, 2003 3:44 am    Post subject: Reply with quote

Much apreciated aprelium. I changed stdout to binary mode with the following:
Code:
#include <fcntl.h>
#include <io.h>

_setmode(_fileno(stdout), _O_BINARY);

And all works as expected.
_________________
Neptune
Back to top View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Aprelium Forum Index -> FastCGI/CGI All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB phpBB Group