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
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Sebastien Robin
erp5
Commits
411e6e1b
Commit
411e6e1b
authored
Mar 02, 2023
by
Arnaud Fontaine
Committed by
Jérome Perrin
Mar 03, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
zope4: ZServer removal: Remove HTTPServer monkey patches.
parent
9a25bc04
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
108 deletions
+0
-108
product/DeadlockDebugger/dumper.py
product/DeadlockDebugger/dumper.py
+0
-22
product/ERP5Type/ZopePatch.py
product/ERP5Type/ZopePatch.py
+0
-3
product/ERP5Type/patches/http_server.py
product/ERP5Type/patches/http_server.py
+0
-83
No files found.
product/DeadlockDebugger/dumper.py
View file @
411e6e1b
...
...
@@ -96,25 +96,3 @@ secret = deadlockdebugger.get('secret', '')
if
dump_url
and
secret
:
dump_url
+=
'?'
+
secret
def
match
(
self
,
request
):
uri
=
request
.
uri
# added hook
if
uri
==
dump_url
:
dump
=
dump_threads
()
request
.
channel
.
push
(
'HTTP/1.0 200 OK
\
n
Content-Type: text/plain
\
n
\
n
'
)
request
.
channel
.
push
(
dump
)
request
.
channel
.
close_when_done
()
LOG
(
'DeadlockDebugger'
,
DEBUG
,
dump
)
return
0
# end hook
if
self
.
uri_regex
.
match
(
uri
):
return
1
else
:
return
0
if
six
.
PY2
:
from
ZServer.HTTPServer
import
zhttp_handler
zhttp_handler
.
match
=
match
product/ERP5Type/ZopePatch.py
View file @
411e6e1b
...
...
@@ -61,9 +61,6 @@ from Products.ERP5Type.patches import PersistentMapping
from
Products.ERP5Type.patches
import
DateTimePatch
from
Products.ERP5Type.patches
import
PythonScript
from
Products.ERP5Type.patches
import
MailHost
if
six
.
PY2
:
# No more ZServer
from
Products.ERP5Type.patches
import
http_server
from
Products.ERP5Type.patches
import
memcache_client
from
Products.ERP5Type.patches
import
StateChangeInfoPatch
from
Products.ERP5Type.patches
import
transforms
...
...
product/ERP5Type/patches/http_server.py
deleted
100644 → 0
View file @
9a25bc04
# This code is taken from the medusa in zope 2.8.
#
# The license term should be this one:
#
# Medusa is Copyright 1996-2000, Sam Rushing <rushing@nightmare.com>
#
# All Rights Reserved
#
# Permission to use, copy, modify, and distribute this software and
# its documentation for any purpose and without fee is hereby
# granted, provided that the above copyright notice appear in all
# copies and that both that copyright notice and this permission
# notice appear in supporting documentation, and that the name of Sam
# Rushing not be used in advertising or publicity pertaining to
# distribution of the software without specific, written prior
# permission.
# Author: Sam Rushing <rushing@nightmare.com>
# Copyright 1996-2000 by Sam Rushing
# All Rights Reserved.
from
ZServer.medusa.http_server
import
http_request
import
ZPublisher.HTTPRequest
import
string
import
base64
import
time
from
six.moves.urllib.parse
import
quote
def
log
(
self
,
bytes
):
addr
=
self
.
channel
.
addr
[
0
]
# Frontend-facing proxy is responsible for sanitising
# HTTP_X_FORWARDED_FOR, and only trusted accesses should bypass
# that proxy. So trust first entry.
#
# <patch>
if
ZPublisher
.
HTTPRequest
.
trusted_proxies
==
(
'0.0.0.0'
,):
# Magic value to enable this functionality
forwarded_for
=
(
self
.
get_header
(
'x-forwarded-for'
)
or
''
).
split
(
','
,
1
)[
0
].
strip
()
if
forwarded_for
:
addr
=
forwarded_for
# </patch>
user_agent
=
self
.
get_header
(
'user-agent'
)
if
not
user_agent
:
user_agent
=
''
referer
=
self
.
get_header
(
'referer'
)
if
not
referer
:
referer
=
''
auth
=
self
.
get_header
(
'Authorization'
)
name
=
'Anonymous'
if
auth
is
not
None
:
if
string
.
lower
(
auth
[:
6
])
==
'basic '
:
try
:
decoded
=
base64
.
decodestring
(
auth
[
6
:])
except
base64
.
binascii
.
Error
:
decoded
=
''
t
=
string
.
split
(
decoded
,
':'
,
1
)
if
len
(
t
)
<
2
:
name
=
'Unknown (bad auth string)'
else
:
name
=
t
[
0
]
# Originally, an unquoted request string was logged, but
# it only confuses log analysis programs! Note that Apache
# HTTP Server never unquote URIs in the access log.
t
=
self
.
request
.
split
(
' '
)
quoted_request
=
'%s %s %s'
%
(
t
[
0
],
quote
(
' '
.
join
(
t
[
1
:
-
1
])),
t
[
-
1
])
self
.
channel
.
server
.
logger
.
log
(
# <patch>
addr
,
# </patch>
'- %s [%s] "%s" %d %d "%s" "%s"
\
n
'
%
(
name
,
self
.
log_date_string
(
time
.
time
()),
# <patch>
quoted_request
,
# </patch>
self
.
reply_code
,
bytes
,
referer
,
user_agent
)
)
http_request
.
log
=
log
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