I've done some more examining and testing and I think the content
might be chunked even though there's nothing advertised in the
headers.

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?

I also had a PHP script subscribe to my test hub where I simply
outputted all the magic global variables, here is the result, maybe it
might shed some light (note the payload XML I'm after there in
HTTP_RAW_POST_DATA):

    [GLOBALS] =3D> Array
 *RECURSION*
    [HTTP_RAW_POST_DATA] =3D> <?xml version=3D"1.0" encoding=3D"utf-8"?>
<feed xmlns=3D"http://www.w3.org/2005/Atom";><title>henrik's
stream</title><id>http://localhost:8081//atom/stream/henrik</id><author><na=
me>henrik</name></author>

<entry><title>8h98h98</title><id>http://localhost:8081/notice/13caea6a-5016=
-4504-8b55-d995d37d78bc</id><link
href=3D"http://localhost:8081/notice/13caea6a-5016-4504-8b55-d995d37d78bc"/=
><summary>89gh97gh9</summary><updated>2009-12-14T22:25:02+01:0</updated></e=
ntry>
</feed>
    [_ENV] =3D> Array
        (
            [APACHE_PID_FILE] =3D> /var/run/apache2.pid
            [PATH] =3D> /usr/local/bin:/usr/bin:/bin
            [LANG] =3D> C
            [APACHE_RUN_GROUP] =3D> www-data
            [APACHE_RUN_USER] =3D> www-data
            [PWD] =3D> /
        )

    [HTTP_ENV_VARS] =3D> Array
        (
            [APACHE_PID_FILE] =3D> /var/run/apache2.pid
            [PATH] =3D> /usr/local/bin:/usr/bin:/bin
            [LANG] =3D> C
            [APACHE_RUN_GROUP] =3D> www-data
            [APACHE_RUN_USER] =3D> www-data
            [PWD] =3D> /
        )

    [_POST] =3D> Array
        (
        )

    [HTTP_POST_VARS] =3D> Array
        (
        )

    [_GET] =3D> Array
        (
        )

    [HTTP_GET_VARS] =3D> Array
        (
        )

    [_COOKIE] =3D> Array
        (
        )

    [HTTP_COOKIE_VARS] =3D> Array
        (
        )

    [_SERVER] =3D> Array
        (
            [CONTENT_LENGTH] =3D> 469
            [HTTP_ACCEPT_ENCODING] =3D> gzip
            [HTTP_X_HUB_SIGNATURE] =3D>
sha1=3D3e8a0378ef256672b47a3628128949315d3e43da
            [HTTP_USER_AGENT] =3D> AppEngine-Google;
(+http://code.google.com/appengine)
            [HTTP_HOST] =3D> localhost
            [HTTP_REFERER] =3D> http://localhost/
            [CONTENT_TYPE] =3D> application/atom+xml
            [PATH] =3D> /usr/local/bin:/usr/bin:/bin
            [SERVER_SIGNATURE] =3D> <address>Apache/2.2.12 (Ubuntu)
Server at localhost Port 80</address>

            [SERVER_SOFTWARE] =3D> Apache/2.2.12 (Ubuntu)
            [SERVER_NAME] =3D> localhost
            [SERVER_ADDR] =3D> ::1
            [SERVER_PORT] =3D> 80
            [REMOTE_ADDR] =3D> ::1
            [DOCUMENT_ROOT] =3D> /var/www
            [SERVER_ADMIN] =3D> webmas...@localhost
            [SCRIPT_FILENAME] =3D> /var/www/pubsub.php
            [REMOTE_PORT] =3D> 45083
            [GATEWAY_INTERFACE] =3D> CGI/1.1
            [SERVER_PROTOCOL] =3D> HTTP/1.1
            [REQUEST_METHOD] =3D> POST
            [QUERY_STRING] =3D>
            [REQUEST_URI] =3D> /pubsub.php
            [SCRIPT_NAME] =3D> /pubsub.php
            [PHP_SELF] =3D> /pubsub.php
            [REQUEST_TIME] =3D> 1260825911
            [argv] =3D> Array
                (
                )

            [argc] =3D> 0
        )

On Mon, Dec 14, 2009 at 9:08 AM, Alexander Burger <a...@software-lab.de> wro=
te:
> Hi Henrik,
>
>> Content-Length: 477
>> Accept-Encoding: gzipX-Hub-Signature:
>> sha1=3Dc22189670d1aeb04d0333d737b3e97f74ccb380e
>> User-Agent: AppEngine-Google; (+http://code.google.com/appengine)
>> Host: localhost:3000
>> Referer: http://localhost/
>> Content-Type: application/atom+xml
>>
>> And the feed contents in the body.
>>
>> I'm missing something fundamental because I'm not able to get at the
>> body using the following addition in the conditions in _htHead:
>>
>> ((match '(@Y "a" "t" "o" "m" @X) L)
>> =A0 (setq *Xml (till)))
>
> The (till) will get the whole stream, until it hits EOF.
>
> For one thing, there might be no EOF, if the protocol is HTTP/1.1 which
> will not necessarily close the connection. Also (in case of HTTP/1.1)
> you must used be prepared to used chunked transfer to read the data.
>
> Then, the line "Content-Type: application/atom+xml" must not necessarily
> be the last line in the HTTP header. The (till) will then read the rest
> of the header as payload data which is probably not what you want.
>
> So you need to first read the whole header, until an empty line is
> encountered, and remember in that course all flags and other data you
> are interested in (as is done in '_htHead'). Then, after the empty line
> was read, you can slurp in the data.
>
> Cheers,
> - Alex
> --
> UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=3dunsubscribe
>
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to