Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Binh
erp5
Commits
4e97d236
Commit
4e97d236
authored
Aug 11, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
shacache: set "infinite" cache HTTP header for content-based URI
parent
cd50a7aa
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
25 deletions
+15
-25
bt5/erp5_web_shacache/ExtensionTemplateItem/portal_components/extension.erp5.ShaCache.py
...TemplateItem/portal_components/extension.erp5.ShaCache.py
+14
-24
bt5/erp5_web_shacache/bt/revision
bt5/erp5_web_shacache/bt/revision
+1
-1
No files found.
bt5/erp5_web_shacache/ExtensionTemplateItem/portal_components/extension.erp5.ShaCache.py
View file @
4e97d236
...
@@ -71,36 +71,26 @@ def File_viewAsWeb(self):
...
@@ -71,36 +71,26 @@ def File_viewAsWeb(self):
RESPONSE
=
self
.
REQUEST
.
RESPONSE
RESPONSE
=
self
.
REQUEST
.
RESPONSE
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
getContentType
())
RESPONSE
.
setHeader
(
'Content-Type'
,
self
.
getContentType
())
RESPONSE
.
setHeader
(
'Content-Length'
,
self
.
getSize
())
RESPONSE
.
setHeader
(
'Content-Length'
,
self
.
getSize
())
RESPONSE
.
setHeader
(
'Cache-Control'
,
'public,max-age=31556926'
)
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
RESPONSE
.
setHeader
(
'Accept-Ranges'
,
'bytes'
)
#
If the file is not a Pdata, we should return the data directly
.
#
Shortcut if the file is not a Pdata
.
data
=
self
.
data
data
=
self
.
data
if
isinstance
(
data
,
str
):
if
isinstance
(
data
,
str
):
RESPONSE
.
setBase
(
None
)
# Do this way instead of 'return data'
return
data
# to bypass default caching policy manager.
RESPONSE
.
write
(
data
)
# Once the object is PData type,
return
# we must iterate and send chunk by chunk.
while
data
is
not
None
:
# For Pdata type, we must iterate and send chunk by chunk.
# Break!! If the channel is closed.
# And no need to continue if the client closed the connection.
# if the client side stops the connection brutally
while
data
and
not
RESPONSE
.
stdout
.
_channel
.
closed
:
# the server side should stop.
if
RESPONSE
.
stdout
.
_channel
.
closed
:
break
# Send data to the client.
# Send data to the client.
RESPONSE
.
write
(
data
.
data
)
RESPONSE
.
write
(
data
.
data
)
# Load next object without keeping previous chunks in memory.
# Load next object.
deactivate
=
data
.
_p_deactivate
next_data
=
data
.
next
data
=
data
.
next
deactivate
()
# Desactivate the object, make sure that this object content
# is not loaded in RAM memory.
data
.
_p_deactivate
()
# Set the new data.
data
=
next_data
return
''
def
WebSite_viewAsWebPost
(
self
,
*
args
,
**
kwargs
):
def
WebSite_viewAsWebPost
(
self
,
*
args
,
**
kwargs
):
portal
=
self
.
getPortalObject
()
portal
=
self
.
getPortalObject
()
...
...
bt5/erp5_web_shacache/bt/revision
View file @
4e97d236
70
71
\ No newline at end of file
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment