[Bese-devel] Serving images through apache

Timothy Jasko tjasko at paragent.com
Wed Sep 13 03:23:41 UTC 2006


A little further information:

Some sniffing has indicated that the png is in fact being sent as  
part of the headers, after which we get a Set-Cookie, then the  
Content-Type, and a Content-Length: 0.

My initial guess is that ucw::network-stream is sending things on to  
apache a bit too soon, so the image data is being sent out before  
we've even finished getting all the headers together (the  
documentation does say "Any bytes written to this stream are sent  
immediatly to the
client" ). I don't know how to get it to work correctly, though.  
Using html-stream definitely does not work.


For the record, apache does serve up static images just fine, and cl- 
gd passes its tests.


On Sep 12, 2006, at 9:29 PM, Timothy Jasko wrote:

> Our application uses cl-gd to generate images. Things work fine  
> using ucw's server, but not when we go through apache. Does anybody  
> have some clues as to what may be going on?
>
> You can see it in action (where "in action" means "not working") at  
> http://archon.paragent.com/charts.ucw .
>
>
> We use this code to generate the images:
>
> (defcomponent png-component ()
>   ((width :accessor width
>           :initarg :width
>           :initform 20)
>    (height :accessor height
>            :initarg :height
>            :initform 20)))
>
> (defmethod render :before ((img png-component))
>   (setf (get-header (context.response *context*) "Content-Type")  
> "image/png"))
>
> (defgeneric render-png (img)
>   (:documentation "Renders the image"))
>
> (defmethod render ((img png-component))
>   (let* ((response (ucw:context.response *context*))
>          (stream (ucw::network-stream response)))
>     (cl-gd:with-image*  ((width img) (height img))
>                         (render-png img)
>                         (write-image-to-stream stream :png))))
> _______________________________________________
> bese-devel mailing list
> bese-devel at common-lisp.net
> http://common-lisp.net/cgi-bin/mailman/listinfo/bese-devel




More information about the bese-devel mailing list