Still no luck, at this point I have no idea if I'm doing something
illegal from a PicoLisp point of view or a HTTP point of view, maybe
someone can shed some light on this.

During testing I have modified (http) and (_htHead) directly, when
I've discovered something that works I expect to be able patch
instead.

In (http):

..
((match '("P" "O" "S" "T" " " "/" @U " " "H" "T" "T" "P" "/" "1" "." @H) L)
                  (on *Post)
                  (off *MPartLim *MPartEnd)
                  (_htHead)
                  (and *Xml
                     (setq *Xml
                        (make
                           (while (link (ht:In T (line T))))))
                     (throw "http"))
                  (cond
                     (*MPartLim (_htMultipart)) ...

If a flag *Xml has been set to T I had hoped the above would get at
the HTTP POST body, the part labeled as RAW by PHP above.

(de _htHead ()
   (use (L @X @Y)
      (setq *Http1 (format (car @H)) *Chunked (gt0 *Http1) *Xml NIL)
      (if (index "~" @U)
         (setq *ConId (pack (head @ @U))  @U (cdr (nth @U @)))
         (off *ConId) )
      (while (setq L (line))
         (cond
            ((match '(@Y "a" "t" "o" "m" @X) L)
               (setq *Xml T)) ...

And setting the flag to T, I've been able to test this one properly,
it's catching the content type header, I will make the match narrower
when this works though.

(de pubsub
   (httpHead "text/plain;")
   (cond
      ((and (=3D "vizual" (req 'hub.verify_token)) (=3D "subscribe" (req
'hub.mode)))
         (prin (req 'hub.challenge))
         (bye))
      (*Xml
         (out "pubsub_feed.xml" (prin (pack "the feed: " *Xml)))
         (ht:Out T (prin "OK"))
         (bye))
      (T (http404))))

Finally the callback function which should output the contents to a file.

Trying to run the above results in the hub reporting a failure to
deliver its payload, and traceAll gives me this when the hub tries to
deliver:

 server : 3000 "@start"
  task : 38 ((http @))
  task =3D (38 (http @))
  http : 38
   _htHead :
   _htHead =3D T
  http =3D NIL

It seems execution is not getting very far?



On Tue, Dec 15, 2009 at 9:25 AM, Henrik Sarvell <hsarv...@gmail.com> wrote:
> Thanks Alex, I've actually tried advertising as both 1.0 and 1.1,
> doesn't seem to make any difference, will try ht:Ln tonight.
>
>
>
> On Tue, Dec 15, 2009 at 7:39 AM, Alexander Burger <a...@software-lab.de> w=
rote:
>> Hi Henrik,
>>
>>> Alex, you mentioned on IRC how to handle/read chunked content and of
>>> course I forgot to save the buffer. Would you care to go through it
>>> again please?
>>
>> This is fairly easy, when you use the functions 'ht:Out' and 'ht:In':
>>
>> =A0 (ht:Out T .. do printing ..)
>>
>> does chunked output, and
>>
>> =A0 (ht:In T .. do reading ..)
>>
>> the corresponding input. The first argument (here 'T') controls if there
>> is any chunking at all.
>>
>> You could take the code in "lib/http.l", "lib/xhtml" and "lib/form.l" as
>> an example. The global '*Chunked' is set in '_htHead' depending on the
>> value of '*Http1', which in turn is zero or one, depending on the match
>> of the first header line. For example,
>>
>> =A0 ((match '("P" "O" "S" "T" " " "/" @U " " "H" "T" "T" "P" "/" "1" "."=
 @H) L)
>>
>> will set '@H' -> '*Http1' accordingly.
>>
>> Then further operation calls (ht:Out *Chunked ...).
>>
>>
>> Besides this, you could also inhibit chunking simply by pretending to be
>> a HTTP/1.0 server. Look in the 'http1' function in "lib/http.l". It
>> outputs the response header depending on that global '*Http1', which
>> could also be set by the program (independent of what the client sent)
>> to zero before starting the response.
>>
>> Cheers,
>> - Alex
>> --
>> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>>
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to