Uhh some questions on my HTTPd implementation...

Andre Garzia soapdog at mac.com
Tue Oct 21 23:31:17 EDT 2003


On Tuesday, October 21, 2003, at 09:55  AM, Dave Cragg wrote:


Thank you very much Dave!!!! I am patching all the code and will 
release a new version soon!!! thanks again!

Cheers
Andre



> Your server isn't writing any http headers. It looks like the other 
> browsers are more forgiving than libUrl about this.
>
> At the very least, you need to supply a line like this:
>
> HTTP/1.1 200 OK
>
> followed by crlf & crlf followed by your data.
>
> Try adding this function at the bottom of your script:
>
> function OKHeaders @pData
>   put "HTTP/1.1 200 OK" & crlf into tRetVal
>   put "Content-Type: text/html" & clrf after tRetVal
>   put "Content-Length: " & length(pData)  after tRetVal
>   return tRetVal
> end OKHeaders
>
> Then in your script where you write the response to the socket, use 
> the function to create the headers. For example, at the end of the 
> serverRead handler, try changing to this:
>
> -------------------------------------------
> --- Well it's not a substack, let's see if we can find it
>
>   put "binfile:" & the defaultFolder & "/html/" & tRequestedDoc into 
> tURL
>   put  the defaultFolder & "/html/" & tRequestedDoc into tPath
>
>   if there is a file tPath then
>     put url tUrl into tData
>     write OKHeaders(tData) & crlf & crlf & tData to socket SocketID
>   else
>     get the cError404 of me
>     replace "%FILE%" with tRequestedDoc in it
>     write it to socket socketID
>   end if
>
>   close socket socketID
> end serverread
> -------------------------------------------
> You'll have to make similar changes where you return data from a 
> substack. You'll also need similar headers for things like 404 errors.
>
> Cheers
> Dave
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> http://lists.runrev.com/mailman/listinfo/use-revolution
>
>
Andre Garzia  2003
imac2 ibook p100 e uma torradeira....



More information about the use-livecode mailing list