a xitami lrwp question

Steve Holden sholden at holdenweb.com
Mon May 13 22:10:02 EDT 2002


"François Lepoutrre" <francois.lepoutre at seriatim.com> wrote in message
news:abiofk$p7o$1 at suaar1aa.prod.compuserve.com...
> Hi all xitami supporters (Steve H., Alex M. ...),
>
> I have read Steve's "python web programming"
> and especially liked the part on xitami lrwp.
>
Thank you! That's one of the pieces I was most pleased about -- Xitami
deserves to be better-known, as it's an ideal lightweight high-capacity web
component.

> We have a working apache "mod_python handler"
> that i tried to port to xitami (on win32).
>
> The whole port was easy. It looks like a pleasant
> alternative especially on win32.
>
Indeed, although of course Apache is much more Windows-friendly than it used
to be.

> Xitami and its persistend fastcgi-like
> "long--running Web processes"
> are a dream to code.
>
> We have a serious problem howvever
> as we dump binary data as well
> as text strings.
>
This shouldn't be a problem.

> From what i could test and peak thru google,
> binary data gets truncated thru the lrwp interface.
>
> >binary data it gets cut off at the first '\0'.
>
> Any way out or hint is welcome.
>
Fortunately it appears that you've been too pessimistic! Here's a test LRWP
process that sends binary data to the client. Note it uses a specifically
binary MIME type in its return stream.

from lrwplib import LRWP

def main():
    lrwp = LRWP('testzeros', 'localhost', 81)
    lrwp.connect()
    count = 0
    while count < 5:        # exit after servicing 5 requests
        count = count + 1
        req = lrwp.acceptRequest()
        req.out.write('Content-type: application/binary\r\n\r\n')
        for i in range(10):
            req.out.write("\000\001\002\003\004\005\006")
        req.finish()

    lrwp.close()

if __name__ == '__main__':
    main()

Accessing this lrwp using a browser brings up a "Save As..." dialog box. I
saved the data file and dumped it, with the following result:

$ od -b /tmp/testzeros
0000000 000 001 002 003 004 005 006 000 001 002 003 004 005 006 000 001
0000020 002 003 004 005 006 000 001 002 003 004 005 006 000 001 002 003
0000040 004 005 006 000 001 002 003 004 005 006 000 001 002 003 004 005
0000060 006 000 001 002 003 004 005 006 000 001 002 003 004 005 006 000
0000100 001 002 003 004 005 006
0000106

The zeros are quite clearly visible, so it appears you were worrying without
need.

> By the way is anyone using xitami+python
> in production.
>
Well, not I -- my two main web sites are externally hosted, and a
pure-Python server runs from my basement. However, you might be interested
in

    http://www.netcraft.com/Survey/Reports/0204/bydomain/com/Xitami.html

> This wonderful little thing is top speedy
> by the way  (millisecond is the testing unit :).
> It seems cleany scalable.
>
I continue to be impressed by the architecture, and I'm glad that you found
Xitami through "Python Web Programming"!

regards
 Steve
--
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list