[Web-SIG] long form and IE... wich server to choose ?

Wilk wilk-ml at flibuste.net
Thu May 5 13:12:42 CEST 2005


Hi,

I have a problem with local server and IE with long form (with lot of
<input>), sometimes IE post two times, sometimes IE answer "cannot show
the page" (impossible d'afficher la page, en français). With firefox it
works everytime...

I tried with cherrpy but it has the same problem.

I post here because i think this kind of problem should be resolved more
easily if i do my application wsgi compliant and can try quickly somes
wsgi servers. But it's curently not easy to find a wsgi server without a
framework.

I could do a short example with BaseHTTPServer (work with nb smaller):

from BaseHTTPServer import HTTPServer
from SimpleHTTPServer import SimpleHTTPRequestHandler
import cgi
import select

class HTTPHandler (SimpleHTTPRequestHandler):
    server_version = "MonServeurHTTP/0.1"
    def do_GET(self):
        if self.path.find('?') != -1:
            self.path, self.requete = self.path.split('?', 1)
        else:
            self.requete = ''
        self.reponse()

    def do_POST(self):
        self.wfile.flush()
        self.requete = self.rfile.read(int(self.headers['Content-Length']))
        while select.select([self.rfile], [], [], 0)[0]:
            if not self.rfile.read(1):
                break


        self.reponse()
     
    def reponse(self):
        self.page = self.path[1:-3]
        self.args = dict(cgi.parse_qsl(self.requete))
        self.send_response(200, 'OK')
        self.send_header('Content-type', 'text/html')
        self.end_headers()

        nb = 500
        self.wfile.write("""<html><body>
        <form name="nomen" action="test" method="post">
        <input name="nb" value="%s">
        <input type="submit">
        %s
        </form>""" % (nb, "\n<br>".join(["<input name='%d'>" % d for d in range(nb)])))

     
httpd = HTTPServer(('', 8080), HTTPHandler)
httpd.serve_forever()

-- 
William - http://flibuste.net



More information about the Web-SIG mailing list