[PATCH] fix: hgweb.fcgi does not work under windows platform (issue1917)

sharkke.w sharkke.w at gmail.com
Wed Feb 16 18:34:50 CST 2011


Function socket.fromfd() is not implemented in versions before python 3.1
under windows, and it seems there also have some problems with python3. Flup
use this function, then it raise an exception instead of serve the web app
correctly.
Some related issues about this socket.fromfd():
http://bugs.python.org/issue10099
<http://bugs.python.org/issue10099>http://bugs.python.org/issue10100

So these lines are only hacks, not common code. May be I should write this
to wiki?
<code>
Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)]
on
win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import socket
>>> socket.fromfd()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'fromfd'
>>>
</code>

On Wed, Feb 16, 2011 at 5:04 AM, Matt Mackall <mpm at selenic.com> wrote:

> On Tue, 2011-02-15 at 19:09 +0800, Sh.W wrote:
> > # HG changeset patch
> > # User Sh.W <sharkke.w at gmail.com>
> > # Date 1297767701 -28800
> > # Node ID b436da44e5f7d26398b1b95bd01f8f701257ad30
> > # Parent  12773f1b7728f0bfdd564fff1800ed99a40b3a6b
> > fix: hgweb.fcgi does not work under windows platform (issue1917)
>
> Can you explain what this is doing and why it's needed? It seems very
> strange.
>
> > diff -r 12773f1b7728 -r b436da44e5f7 contrib/hgweb.fcgi
> > --- a/contrib/hgweb.fcgi      Mon Feb 14 18:04:20 2011 -0600
> > +++ b/contrib/hgweb.fcgi      Tue Feb 15 19:01:41 2011 +0800
> > @@ -14,5 +14,16 @@
> >  from mercurial import demandimport; demandimport.enable()
> >  from mercurial.hgweb import hgweb
> >  from flup.server.fcgi import WSGIServer
> > +import sys
> > +
> >  application = hgweb(config)
> > -WSGIServer(application).run()
> > +if sys.platform == "win32":
> > +    wsgi_opts = {
> > +            'maxSpare': 5,
> > +            'minSpare': 2,
> > +            'maxThreads': 50,
> > +            'bindAddress': ('127.0.0.1', 8091),
> > +    }
> > +    WSGIServer(application, **wsgi_opts).run()
> > +else:
> > +    WSGIServer(application).run()
> > _______________________________________________
> > Mercurial-devel mailing list
> > Mercurial-devel at selenic.com
> > http://selenic.com/mailman/listinfo/mercurial-devel
>
>
> --
> Mathematics is the supreme nostalgia of our time.
>
>
>


-- 
Best wishes to you!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20110217/91c13fb4/attachment.htm>


More information about the Mercurial-devel mailing list