Re: Some newbie questions: http-client, logging.

Piotr Klibert <[email protected]> Mon, 1 Sep 2014 00:02:53 +0200
Newsgroups gmane.comp.lang.dylan.gwydion.devel
Message-ID <CAKQQ0av0SbSx_1wRurOYpZwNMkhiZGkj2oLsi9q0Ln9Q4uq4GQ@mail.gmail.com>
Thanks for your response.

>
> If I recall correctly you can also get a header value with
>  element(response, "Connection", default: #f)
> because the response is an instance of <message-headers-mixin>.
>

I don't think so. This:
https://github.com/dylan-lang/http/blob/master/common/headers.dylan#L16
and this: https://github.com/dylan-lang/http/blob/master/common/headers.dylan#L104
seems to suggest that I need to use get-header accessor. But I guess
implementing element for <message-headers-mixin> would be trivial in
Dylan :-)

>
> That was intended for debugging the http code itself and so isn't exported.
> (It should be removed.)
>

The reason why I ask about *debug-reads?* is that I'm trying to debug
http-get function. It doesn't seem to work for me for some reason. It
refuses to take a string as an argument and makes me call parse-url on
the url, but I guess that's ok, the problem is that it just hangs and
then dies with 110 (timeout) socket error.

The request I do is to my own site, which is behind CloudFlare at the
moment, which means it uses chunked Transfer-Encoding (but I tested it
with 'direct' subdomain which exposes my nginx directly and there is
Content-Length in headers). I tested it mainly with this site, which
means it may return some peculiar response, which confuses some part
of response handling code.

You can (hopefully!) reproduce this behaviour with this simple
program: https://gist.github.com/piotrklibert/d1acddad89bcad944a0e - I
also attached program output there for quick inspection.

Some other things: I discovered "keyed-by" extension to for syntax,
which can replace key-sequence. Nice.

I'm working with Emacs mode and I found its indentation code breaks in
some situations. I didn't look into it yet, but as a heavy Emacs user
I probably will.

It's a bit of a pain to have to look in two separate files for
definitions and their exported names. Dylan module system indeed is
similar to Racket's, but there the `provide` and `require` forms are
in the same file (more precisely, inside a module, as you can have
many modules in single file). I expect a decent IDE would make it a
non-issue and I'll see what I can do with Emacs mode to this end.

I need to look into XML library (I love the use of macros here:
https://github.com/dylan-lang/xml-parser/blob/40bd659debb9cb3623ec971d3c2ce29c33bf33a7/latin1-entities.dylan
), signal/error handling and cleanups, threads library (where
apparently dynamic-bind lives?) and I have still quite a bit of
language spec to read (collections and other built-ins, not to mention
the whole sealed/open thing), so I will be busy with all this for
quite a while, I think.

But please tell me if you have no time to debug http-client thing I
encountered (if it indeed is a bug in the library), I'll try and do my
best here too :-)


Best regards,
Piotr Klibert