diff --git a/lib/config.coffee b/lib/config.coffee index 81559d8..d45a39a 100644 --- a/lib/config.coffee +++ b/lib/config.coffee @@ -49,6 +49,7 @@ options = { SESSION_TIMEOUT : {type : 'int', default : 30}, GET_PARAMETER_NAMES_DEPTH_THRESHOLD : {type : 'int', default : 0}, TASK_PARAMETERS_BATCH_SIZE : {type : 'int', default : 32}, + COOKIES_PATH : {type : 'string'}, # Libxml related configuration XML_PARSE_RECOVER : {type : 'bool'}, diff --git a/lib/cwmp.coffee b/lib/cwmp.coffee index 67f956c..0b7b107 100644 --- a/lib/cwmp.coffee +++ b/lib/cwmp.coffee @@ -131,7 +131,12 @@ inform = (currentRequest, cwmpRequest) -> methodResponse : {type : 'InformResponse'}, cwmpVersion : cwmpRequest.cwmpVersion }) - res.headers['Set-Cookie'] = "session=#{currentRequest.sessionId}" + + if !!cookiesPath = config.get('COOKIES_PATH', currentRequest.session.deviceId) + res.headers['Set-Cookie'] = "session=#{currentRequest.sessionId}; Path=#{cookiesPath}" + else + res.headers['Set-Cookie'] = "session=#{currentRequest.sessionId}" + writeResponse(currentRequest, res) ) )