From b4b011663e8a5c96ef72380b257919bcfd4c6d37 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 5 Mar 2025 17:14:28 -0500 Subject: [PATCH] Handle more forms of confluent headers Some frameworks won't allow headers through, normalize case and normalize _ presence. --- confluent_server/confluent/httpapi.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/confluent_server/confluent/httpapi.py b/confluent_server/confluent/httpapi.py index 2fbc700b..0b2abb4d 100644 --- a/confluent_server/confluent/httpapi.py +++ b/confluent_server/confluent/httpapi.py @@ -629,8 +629,11 @@ def wsock_handler(ws): def resourcehandler(env, start_response): for hdr in env['headers_raw']: - if hdr[0].startswith('CONFLUENT_'): - env['HTTP_' + hdr[0]] = hdr[1] + if hdr[0].lower().startswith('confluent'): + hdrname = hdr[0].upper() + if '_' not in hdrname: + hdrname = hdrname.replace('CONFLUENT', 'CONFLUENT_') + env['HTTP_' + hdrname] = hdr[1] try: if 'HTTP_SEC_WEBSOCKET_VERSION' in env: for rsp in wsock_handler(env, start_response):