Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- #
- # Demonstrates IE inconsistency when receiving Location header with a URL hash
- #
- # It maintains the hash after a POSTing a normal form,
- # and loses it after a multipart POST with a file field.
- #
- # Inconsistency tested on versions IE8, IE9.
- #
- # 'pip install flask' then run and connect with your browser to port 5000.
- from flask import Flask, Response, request, redirect
- app = Flask(__name__)
- tmpl = """
- <!DOCTYPE html>
- <html>
- <head>
- <title>Test IE location hash bug</title>
- </head>
- <body>
- <form method="POST" enctype="multipart/form-data" action="/">
- <input type="file" name="ff">
- <input type="submit" name="submit" value="multipart">
- </form>
- <form method="POST" enctype="" action="/">
- <input type="submit" name="submit" value="normal">
- </form>
- </body>
- </html>
- """
- @app.route('/', methods=['GET', 'POST'])
- def index():
- if request.method == 'POST':
- return redirect('/#{}'.format(request.form['submit']))
- else:
- return Response(tmpl)
- if __name__ == '__main__':
- app.run(host='0.0.0.0')
Add Comment
Please, Sign In to add comment