diff test/wsgi_liveserver.py @ 7150:72a54826ff4f

better rest Origin check; refactor CORS preflight code. A previous version allowed requests without an origin that should require it (e.g. an OPTIONS or PATCH request). Moved the origin checking logic into the main flow. It looks like this was limited to OPTIONS/PATCH requests as handle_csrf() (called later in the main flow) handles POST, PUT, DELETE verbs. Refactored CORS preflight request code into functions and call them from main flow. Also return immediately. Prior code processed the options request a second time due to falling through. Modified is_origin_header_ok to return True if origin was missing and it was a get request. Fixed tests that make OPTIONS requests to supply origin. Comment fixups.
author John Rouillard <rouilj@ieee.org>
date Tue, 21 Feb 2023 16:42:20 -0500
parents e9760702bf0c
children f6923d2ba9a5
line wrap: on
line diff

Roundup Issue Tracker: http://roundup-tracker.org/