You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-dev@quetz.apache.org by Greg Stein <gs...@lyra.org> on 2003/06/24 08:54:34 UTC

Re: cvs commit: httpd-python/test/htdocs tests.py

On Tue, Jun 24, 2003 at 04:16:01AM -0000, grisha@apache.org wrote:
>...
>   +++ test.py	24 Jun 2003 04:16:00 -0000	1.32
>...
>   +        conn = httplib.HTTPConnection("127.0.0.1:%s" % PORT)

Much simpler to write that as:

  conn = httplib.HTTPConnection('127.0.0.1', PORT)

>   +        conn.putrequest("GET", "/testz.py", skip_host=1)

Note that the skip_host argument didn't appear until 2.2.1. People won't be
able to run this test with anything less. (maybe not a problem?)

>   +        # this is three cookies, nastily formatted
>   +        conn.putheader("Host", "test_Cookie_Cookie:%s" % PORT)
>   +        conn.putheader("Cookie", "spam=foo; path=blah;;eggs=bar;")
>   +        conn.putheader("Cookie", "bar=foo")
>   +        conn.endheaders()

And to write this as:

  conn.request('GET', '/testz.py', headers={
    'Host' : 'test_Cookie_Cookie:%s' % PORT,
    'Cookie' : ...
    })

>...
>   +        conn = httplib.HTTPConnection("127.0.0.1:%s" % PORT)
>   +        conn.putrequest("GET", "/testz.py", skip_host=1)
>   +        conn.putheader("Host", "test_Cookie_MarshalCookie:%s" % PORT)
>   +        conn.putheader("Cookie", mc)
>   +        conn.endheaders()

Same.

>...

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/

Re: Shared memory

Posted by Sterling Hughes <st...@bumblebury.com>.
Well, portability is a concern.  mmap() with MAP_ANONYMOUS is the best
way to do shared memory on systems that support it (it automatically
cleans up shared memory for you, and it is just as fast).  But
MAP_ANONYMOUS is not POSIX, iirc its supported on only FreeBSD and Linux
(definitely not Windows).

-Sterling

On Tue, 2003-06-24 at 15:22, Gregory (Grisha) Trubetskoy wrote:
> I see this question asked a lot on the mod_python list, so I spent some
> time looking at this -
> 
> Unless I'm missing something, Python's mmap module makes it very easy.
> Given that mmap is standard in Python, does anyone have any opinion on it
> vs APR shared memory
> (http://apr.apache.org/docs/apr/group__APR__SHM.html)? Would there be any
> benefit in building a mod_python interface to APR SHM?
> 
> Grisha
-- 
"A business that makes nothing but money is a poor kind of business." 
    - Henry Ford

Shared memory

Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
I see this question asked a lot on the mod_python list, so I spent some
time looking at this -

Unless I'm missing something, Python's mmap module makes it very easy.
Given that mmap is standard in Python, does anyone have any opinion on it
vs APR shared memory
(http://apr.apache.org/docs/apr/group__APR__SHM.html)? Would there be any
benefit in building a mod_python interface to APR SHM?

Grisha

Re: cvs commit: httpd-python/test/htdocs tests.py

Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
On Mon, 23 Jun 2003, Greg Stein wrote:

> >   +        conn.putheader("Host", "test_Cookie_Cookie:%s" % PORT)
> >   +        conn.putheader("Cookie", "spam=foo; path=blah;;eggs=bar;")
> >   +        conn.putheader("Cookie", "bar=foo")
> >   +        conn.endheaders()
>
> And to write this as:
>
>   conn.request('GET', '/testz.py', headers={
>     'Host' : 'test_Cookie_Cookie:%s' % PORT,
>     'Cookie' : ...
>     })

Interesting -I was using putheader() because of the "host:" header if I
remember it correctly, I wonder if I overlooked it or conn.request()
started paying attention to the "host" only later (looks like 2.2.1 based
on cvs info...)

But in this particular case I wanted two "Cookie" headers to add to the
confusion. It was worth it, because I learned in the process that httpd
comma-joins them into one.

Which, as a side note, is perfectly RFC compliant, but demonstrates a flaw
in the Netscape spec because they specify a date format for "expires"
which contains a comma, and is not quoted. But they wrote their spec
before RFC2616, so it's not their fault.

Overall, having been reading up on Cookies in the past two weeks, I must
say I am quite amazed at what a mess the current state of Cookie standards
really is and surprised that noone took the initiative to write about it
and start sorting it out... I think HTTP State could be a great subject
for someone to study as "Standardization gone wrong".

Grisha

Re: cvs commit: httpd-python/test/htdocs tests.py

Posted by "Gregory (Grisha) Trubetskoy" <gr...@apache.org>.
On Mon, 23 Jun 2003, Greg Stein wrote:

> Note that the skip_host argument didn't appear until 2.2.1. People won't be
> able to run this test with anything less. (maybe not a problem?)

not really, since mod_python won't even compile with anything less than
2.2.1 because it uses the "new" classes

Thanks for the tips!

Grisha