0

I've created a perl script c.pl

print "Content-type: image/gif\n\n";
...    
and
...
exit 200;

output is :

Content-type: image/gif GIF89an

... this is wrong. it seems to generate output of Content-type: text/html prior...

how can I make it output as image/gif header?

Gil
  • 3,279
  • 1
  • 15
  • 25
stashfree
  • 655
  • 6
  • 22

1 Answers1

1

The default Content-type HTTTP header is text/html. But you can (and here should) change it - either by using CGI variables or by writting your HTTP headers from your script.

G-WAN comes with many examples doing that, see fractal.c.

Gil
  • 3,279
  • 1
  • 15
  • 25
  • seems very complicated just for perl script. is it possible to just remove the prior Content-type of text/html? I can just do print "Content-type: image/gif\n\n"; – stashfree Dec 02 '14 at 00:54
  • *"can't Ijust do print "Content-type: image/gif\n\n""?* You should write correct (complete) HTTP headers. Check the HTTP protocol. – Gil Dec 03 '14 at 21:13