Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 10:29:35AM +, Tomas Hlavaty wrote:
 What about using 'peek' on the last char?

Yes, this might do.

 A C function 'char1' might be fastest fix probably.

Or 'ht:Read' in src/ht.c, usable as: (ht:Read *ContLen)

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


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Tomas Hlavaty
 I was thinking about rewriting the server, I already wrote a
 prototype asynchronous http server but I have only the reading part
 non-blocking and not the writing part yet.  I do not want to spend
 too much time on it right now.

Sorry, I was not clear.  It would not have to be a asynhronous server,
just structured a bit differently than the current one... but then how
far do we want to go changing the server?  We would need to be careful
to keep it working with @lib/form.l

Cheers,

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Tomas Hlavaty
 An even better solution might be to extend the built-in 'line' function
 in that a way that when only a single 'cnt' argument is passed it is
 taken as a length parameter. The idea is that in the current semantics
 of 'line' a single 'cnt' argument makes no sense.

But would cnt mean number of chars or number of bytes?  That could be
confusing.

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Reference links in generators

2008-11-23 Thread Henrik Sarvell
I just realized I haven't had the need to do a reference link lookup
until know and don't really know how.

Pretend we have +User(s), they are from different countries like so:
(rel country  (+Ref +Link) NIL (+Country))

Now if I want to have all the Germans, how would that generator look?

Maybe like this?:

(country +User (db nm +Country @CountryName))

Or is there an easier way?

I'm looking at this example:
http://www.mail-archive.com/picolisp@software-lab.de/msg00567.html

But I don't really understand what is happening there since I don't
know what is hiding behind all the symbols, what is the meaning of
this line for instance: (nm +Ort @Ort (ort @Cls)) that last (ort
@Cls)?

Cheers,

/Henrik
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Alexander Burger
On Sun, Nov 23, 2008 at 01:16:55PM +0100, Alexander Burger wrote:
 Let me investigate a solution like (ht:Read *ContLen), returning a
 single-char-line for a given number of bytes.

OK, I've built this now. The 'ht' library has a new function 'Read'. I
had also to change lib/form.js (remove the linefeeds from the data
sent by a XMLHttpRequest).

It is available in the new picoLisp.tgz. I hope this is all right.
Needs good testing ;-)

@Henrik: Now it should be OK if you remove your patch from jQuery.

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


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Alexander Burger
Hi Tomas,

 you to get http query vars in assoc list (see *HtVars and
 *HtVarsHook).

Sometimes it is possible to make application-specific changes or
extensions dynamically at application startup, without the need to
modify the system files.

For example, your extension of '_htSet'

 (de _htSet (Var Val)
(if (and *HtVarsHook (*HtVarsHook))
   (push '*HtVars (cons (pack Var) Val))
   (use (@N @V @Z)
 ...

can also be be achieved with

   (redef _htSet @
  (if (and *HtVarsHook (*HtVarsHook))
 (push '*HtVars (cons (pack (next)) (next)))
 (pass _htSet) ) )

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


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Tomas Hlavaty
Hi Alex,

thanks for fixing it.

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Tomas Hlavaty
Hi Alex,

(redef _htSet @
   (if (and *HtVarsHook (*HtVarsHook))
  (push '*HtVars (cons (pack (next)) (next)))
  (pass _htSet) ) )

thank you, I will use this;-)

Tomas
-- 
UNSUBSCRIBE: mailto:[EMAIL PROTECTED]


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Alexander Burger
Henrik + Tomas,

many thanks for pointing out this bug! I feel much better now :-)

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


Re: http server hangs on post without enctype=multipart/form-data

2008-11-23 Thread Alexander Burger
Hi Tomas,

 I would expect 'char' to block and return next character when
 available and 'peek' return the next character if available otherwise
 return nothing without blocking.

On that level there is no concept of blocking. Data are read as a
logical stream. Something similar to what you suggest might be achieved
with 'poll', but not completely, and probably not in our case.

'peek' returning nothing would have a different meaning. For normal
operations I *do* it want to block, until I receive all data.


 I guess it seems broken to me because of the two char lookahead in
 'char', but is it necessary?  Is it only to handle different line
 endings?

'char' has to cooperate with 'read', 'line', 'till', 'skip, etc. And the
logic behind these functions (most notably 'read') require that
internally there is always a single-character lookahead, and thus one
more character read than necessary.

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