Now it's getting funny. I have written a tiny webserver in imc, that can
serve the parrot html documentation. That's also a pretty good test for
the NET_DEVEL and file readings functions. I tested it on win32, so no
idea what happens on unix.
The attached file should be placed in examples/io (no idea how to create
a /dev/null patch on win32!).
This patch depends of course on #34120.
have fun
Markus
Applied 34117, 34120, 34121, 34126 in a bunch.
> Now it's getting funny. I have written a tiny webserver in imc, that can
> serve the parrot html documentation.
Great, thanks. Some remarks:
- served line endings should by "\r\n": lynx doesn't work with "\n" only
- reading html files should used the C<stat> opcode to determine the
file size
While at socket IO:
- all the current socket opcodes should be available as ParrotIO methods,
e.g.
METHOD PMC* socket(...) {...}
METHOD INTVAL bind(STRING *address) {...}
so that:
pio = getclass "ParrotIO"
sock = pio."socket"(.PIO_SOCK_FAM_PF_INET, \
.PIO_SOCK_TYPE_SOCK_STREAM, \
.PIO_SOCK_PROTO_IP)
res = sock."bind"(address)
works.
- patches welcome to allow constants for the C<socket> opcode's "magic
numbers". See: config/gen/parrot_include.pl and the &gen_from_*
directives.
The enums should be attached to the C<socket> method.
leo
> While at socket IO:
>
> - all the current socket opcodes should be available as ParrotIO methods,
> e.g.
>
> METHOD PMC* socket(...) {...}
> METHOD INTVAL bind(STRING *address) {...}
>
> so that:
>
> pio = getclass "ParrotIO"
> sock = pio."socket"(.PIO_SOCK_FAM_PF_INET, \
> .PIO_SOCK_TYPE_SOCK_STREAM, \
> .PIO_SOCK_PROTO_IP)
>
> res = sock."bind"(address)
>
> works.
TODO
> - patches welcome to allow constants for the C<socket> opcode's "magic
> numbers". See: config/gen/parrot_include.pl and the &gen_from_*
> directives.
> The enums should be attached to the C<socket> method.
TODO
Propably due to recent charset changes, I found that httpd.imc was no
longer working under Linux. The op 'recv' seems to return a 'binary'
string. However for 'binary' the 'index' op is not implemented, thus
httpd.imc can't check for "\r\n\r\n".
I don't know how to transcode a 'binary' to 'ascii'. Therefore
I made a dirty hack, telling PIO_unix_recv to return an 'ascii' string.
--
/* Bernhard.S...@gmx.de */
> Propably due to recent charset changes, I found that httpd.imc was no
> longer working under Linux. The op 'recv' seems to return a 'binary'
> string. However for 'binary' the 'index' op is not implemented, thus
> httpd.imc can't check for "\r\n\r\n".
Ah yep. Ok. We can do any cobination of:
* create an "ascii" IO layer
* implement binary index
* create ascii string is the first place
* implement to_charset for binary
leo