[Twisted-web] twisted web and "Method Not Allowed"

John Que qwejohn at hotmail.com
Tue May 31 04:05:39 MDT 2005


  I had posted this question in a different twisted mailing list but did not
got a solution ; I hope that maybe members of this forum can help me
a bit.

I am trying the exmaple in the python docs -

Configuring and Using the Twisted.Web Server - Twisted Web Development.

it says there:

"You can also create a Site instance by hand, passing it a Resource
object which will serve as the root of the site:

from twisted.web import server, resource
from twisted.internet import reactor

class Simple(resource.Resource):
    isLeaf = True
    def render_GET(self, request):
        return "<html>Hello, world!</html>"

site = server.Site(Simple())
reactor.listenTCP(8080, site)
reactor.run()   "

So I prepared a script named myhttp exactly like this and ran ./myhttp

I had made sure with netstat that indeed port 8080 was free before
running the script and after
running the script it was in a listening state.

But when pointing the Mozilla browser to http://localhost:8080 (or
I got the following error:

"Method Not Allowed
Your browser approached me (at /) with the method "GET". I only allow
the method here."

I had also made sure that there in no problem with iptables and that
the iptable service is down.

I had also tried:

telnet localhost 8080
Connected to localhost.
Escape character is '^]'.
GET / HTTP/1.0

And I got this as a response:

HTTP/1.0 405 Method Not Allowed
Date: Tue, 31 May 2005 13:45:29 GMT
Content-length: 242
Content-type: text/html
Allow: ()
Server: TwistedWeb/2.0.0

        <head><title>405 - Method Not Allowed</title></head>
        <body><h1>Method Not Allowed</h1>
            <p>Your browser approached me (at /) with the method "GET".
I only
allow the method  here.</p>

Connection closed by foreign host.

Tracing this error shows that this it stems from twisted/web/server.py.
I also tried it on a second machine with the latest stable releases
(TwistedWeb-0.5.0, Twisted-2.0.1 , Python-2.4.1, and
and I got the same error.

I am trying it on RedHat 9 Linux (x386 based).

Any idea ?

Am I missing something?

Any help will be appreciated.


Express yourself instantly with MSN Messenger! Download today it's FREE! 

More information about the Twisted-web mailing list