Re: using the http server to return xml

2008-10-04 Thread konrad Zielinski
I think my problem with setting mime types originally was due to
basing my code on the initial hello world example, where the html
function is called bare inside project.l. In this model the call to
server is on the command line.

I'm guessing this means that Mime remains whatever it was when server
started and my setting of mime was taking place in a forked process
for the request, and hence was not actually affecting anything. I am
guessing here as I havn't read the http code in detail yet. Now that
I'm doing somthing similer to the sample application and having a
app.l which does all the loading and calls server from inside picoLisp
code I suspect things will work correctly.

I still don't quite follow what curl is supposed to be showing is
wrong with my use of http header. I'm installing it now and will dig
further. I'm determined to get this thing working right.

On 04/10/2008, Alexander Burger [EMAIL PROTECTED] wrote:
 Hi Konrad,

 I've got it returning an actual .xml file ok. (had to modify the
 definition of *Mimes directly as calling (mime xml text/xml 1)
 didn't seem to have any effect.

 Though this is not central to your question, it is strange because it
 should work.

 Where in your code did you call 'mime'? Should be ok anytime after
 lib/http.l is loaded.

 Cheers,
 - Alex
 --
 UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: using the http server to return xml

2008-10-04 Thread konrad Zielinski
Thanks Alex,

the following fixed the problem. As the bulk of my app will be sending
xml files arround like this I guess I can make these settings globally
for the application. I'm not entierly sure what the implications are.
but I suspect their not too important providing my documents don't
grow to some ridiculous size.

regards

Konrad.

On 04/10/2008, Alexander Burger [EMAIL PROTECTED] wrote:
 On Fri, Oct 03, 2008 at 09:32:43PM +1000, konrad Zielinski wrote:
 (de mydata2 ()
  (httpHead text/xml; charset=utf-8 1)
  (xml? T)
  (xml '(root NIL Document 2))
  )

 mydata works perfectly. mydata2 fails to roduce any output. Now the

 Not sure what the problem is, but two things come to mind:

 1. In which context is 'mydata2' called? If the connection is not closed
for some reason, you could try to call (flush) after sending the
data.

 2. If the initial request from the browser was HTTP/1.1, then the global
'*Http1' is set to '1', causing the picoLisp server to initiate a
chunked transfer. You could try

   (let (*Http1 0  *Chunked NIL)
  (httpHead text/xml; charset=utf-8 1) )

 Cheers,
 - Alex
 --
 UNSUBSCRIBE: mailto:[EMAIL PROTECTED]

-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: using the http server to return xml

2008-10-04 Thread Alexander Burger
On Sat, Oct 04, 2008 at 10:22:49PM +1000, konrad Zielinski wrote:
 I'm guessing this means that Mime remains whatever it was when server
 started and my setting of mime was taking place in a forked process
 for the request, and hence was not actually affecting anything. I am

Yes, this was probably the reason.
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: using the http server to return xml

2008-10-04 Thread Alexander Burger
Hi Konrad,

 xml files arround like this I guess I can make these settings globally
 for the application. I'm not entierly sure what the implications are.

It is possible to set '*Http1' and '*Chunked' globally, but you must
sure that this takes place each time after a HTTP GET or POST request,
because they are set internally by the server (in '_htHead') according
to the type of request.

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]