Commit 362a0b60 authored by Łukasz Nowak's avatar Łukasz Nowak

Fine tune response.

parent 6d31793b
...@@ -257,12 +257,13 @@ class SlapTool(BaseTool): ...@@ -257,12 +257,13 @@ class SlapTool(BaseTool):
# result = self._getComputerInformation(computer_id, user, False) # result = self._getComputerInformation(computer_id, user, False)
result = self._getComputerInformation(computer_id, user, False) result = self._getComputerInformation(computer_id, user, False)
# Keep in cache server for 1 year # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
self.REQUEST.response.setHeader('Cache-Control', self.REQUEST.response.setHeader('Cache-Control',
'max-age=60, stale-if-error=31536000') 'public, max-age=60, stale-if-error=604800')
self.REQUEST.response.setHeader('Vary', self.REQUEST.response.setHeader('Vary',
'REMOTE_USER') 'REMOTE_USER')
self.REQUEST.response.setHeader('Last-Modified', rfc1123_date(DateTime()))
self.REQUEST.response.setBody(result) self.REQUEST.response.setBody(result)
return self.REQUEST.response return self.REQUEST.response
...@@ -286,12 +287,13 @@ class SlapTool(BaseTool): ...@@ -286,12 +287,13 @@ class SlapTool(BaseTool):
# return self._getComputerInformation(computer_id, user, True) # return self._getComputerInformation(computer_id, user, True)
result = self._getComputerInformation(computer_id, user, True) result = self._getComputerInformation(computer_id, user, True)
# Keep in cache server for 1 year # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
self.REQUEST.response.setHeader('Cache-Control', self.REQUEST.response.setHeader('Cache-Control',
'max-age=60, stale-if-error=31536000') 'public, max-age=60, stale-if-error=604800')
self.REQUEST.response.setHeader('Vary', self.REQUEST.response.setHeader('Vary',
'REMOTE_USER') 'REMOTE_USER')
self.REQUEST.response.setHeader('Last-Modified', rfc1123_date(DateTime()))
self.REQUEST.response.setBody(result) self.REQUEST.response.setBody(result)
return self.REQUEST.response return self.REQUEST.response
...@@ -600,12 +602,13 @@ class SlapTool(BaseTool): ...@@ -600,12 +602,13 @@ class SlapTool(BaseTool):
slap_partition._parameter_dict.update(parameter_dict) slap_partition._parameter_dict.update(parameter_dict)
result = xml_marshaller.xml_marshaller.dumps(slap_partition) result = xml_marshaller.xml_marshaller.dumps(slap_partition)
# Keep in cache server for 1 year # Keep in cache server for 7 days
self.REQUEST.response.setStatus(200) self.REQUEST.response.setStatus(200)
self.REQUEST.response.setHeader('Cache-Control', self.REQUEST.response.setHeader('Cache-Control',
'max-age=60, stale-if-error=31536000') 'public, max-age=60, stale-if-error=604800')
self.REQUEST.response.setHeader('Vary', self.REQUEST.response.setHeader('Vary',
'REMOTE_USER') 'REMOTE_USER')
self.REQUEST.response.setHeader('Last-Modified', rfc1123_date(DateTime()))
self.REQUEST.response.setBody(result) self.REQUEST.response.setBody(result)
return self.REQUEST.response return self.REQUEST.response
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment