changeset 3223:9a89ec5030b5

mod_auth_http_cookie: Try to get HTTP request from array on BOSH sessions This looks like a cleaner way. `session.requests` appears to have been around a longer time than `_http_open_response`.
author Kim Alvefur <zash@zash.se>
date Fri, 10 Aug 2018 06:10:38 +0200
parents c22b6283d226
children b7aa8630438e
files mod_auth_http_cookie/mod_auth_http_cookie.lua
diffstat 1 files changed, 6 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_auth_http_cookie/mod_auth_http_cookie.lua	Thu Aug 09 22:40:18 2018 +0100
+++ b/mod_auth_http_cookie/mod_auth_http_cookie.lua	Fri Aug 10 06:10:38 2018 +0200
@@ -142,8 +142,12 @@
 end
 
 local function get_session_cookies(session)
-	local response = session.conn._http_open_response;
-	local request = response and response.request;
+	local request = session.requests[1];
+	end
+	if not request and session.conn._http_open_response then -- Fallback BOSH
+		local response = session.conn._http_open_response;
+		request = response and response.request;
+	end
 	if request then
 		return request.headers.cookie;
 	end