uranusjr edited a comment on issue #20063:
URL: https://github.com/apache/airflow/issues/20063#issuecomment-989402511


   I tracked this down to pallets/flask#900, and as Armin mentioned when he 
closed the ticket, the problem is in WSGI—`%2f` is treated exactly as `/` and 
there’s no way to work around that in the application layer because `%2f` has 
already been decoded when it’s received by e.g. Flask.
   
   @andrewgodwin Does ASGI have the same problem? If not, I wonder if it’d work 
if we move from Gunicorn to e.g. Uvicorn and run Flask with `WsgiToAsgi`.
   
   ----
   
   Update: I played with this a bit. This is still be a problem in 
`agsiref.wsgi` because according to the [ASGI 
spec](https://asgi.readthedocs.io/en/latest/specs/www.html):
   
   > `path` *(Unicode string)* – HTTP request target excluding any query 
string, with percent-encoded sequences and UTF-8 byte sequences decoded into 
characters.
   
   But there’s also `raw_path` that does retain the undecoded URL, so this 
should be fixable by
   
   * Switch to an ASGI web server.
   * Implement a ASGI-WSGI adapter that retains the percent encoded path.
   * Implement a custom [URL 
adapter](https://flask.palletsprojects.com/en/2.0.x/api/#flask.Flask.create_url_adapter)
 that percent-decode the path components instead.
   
   But of course the question is whether this is worth the hassle 😛


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@airflow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to