[Klone-users] Unwanted newline added after the header

thomas fossati tho at koanlogic.com
Mon Sep 29 10:41:20 EDT 2008


Hi Petr,

On Sep 29, 2008, at 4:07 PM, Petr Cizmar wrote:
> Hello,
>
> I'm trying to use klone to output different mime-types, for example  
> PNG
> images. Unfortunately klone adds a newline at the beginning of the
> output which spoils the integrity of the PNG file. My code looks like
> this:
>
>
>
>   response_set_content_type(response, rec->sup_mime_type);
>
>   response_set_field(response, "Pragma:", "no-cache");
>   response_set_field(response, "Cache-Control", "no-cache, no-store,  
> must-revalidate");
>   response_set_field(response, "Expires:", "Mon, 26 Jul 1997  
> 05:00:00 GMT");
>   io_codecs_remove(response_io(rs));
>   response_print_header(response);
>
>   do{
> 	   len = read(fileno(fi), buffer, CP_BUFF_SIZE);
> 	   io_write(out,buffer,len);
> 	   } while (len);
>
>
> Does anybody know what do I do wrong or where could I get some more
> information?


try not to add a newline between the declaration block and the "code"  
block:

<%!
     // C decls
%><%
     // C code
%>

ciao, t.




More information about the klone-users mailing list