Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
f5553ba2
Commit
f5553ba2
authored
Dec 19, 2000
by
Michel Pelletier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make start script output intelligible
parent
678a457e
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
110 additions
and
2 deletions
+110
-2
ZServer/HTTPServer.py
ZServer/HTTPServer.py
+55
-1
lib/python/ZServer/HTTPServer.py
lib/python/ZServer/HTTPServer.py
+55
-1
No files found.
ZServer/HTTPServer.py
View file @
f5553ba2
...
...
@@ -110,13 +110,14 @@ import os
import
types
import
thread
import
time
import
socket
from
cStringIO
import
StringIO
from
PubCore
import
handle
from
HTTPResponse
import
make_response
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
medusa.http_server
import
http_server
,
http_channel
from
medusa.http_server
import
http_server
,
http_channel
,
VERSION_STRING
from
medusa
import
counter
,
producers
,
asyncore
,
max_sockets
from
medusa.default_handler
import
split_path
,
unquote
,
get_header
from
medusa.asyncore
import
compact_traceback
,
dispatcher
...
...
@@ -125,6 +126,7 @@ from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION
from
zLOG
import
LOG
,
register_subsystem
,
BLATHER
,
INFO
,
WARNING
,
ERROR
import
DebugLogger
from
medusa
import
logger
register_subsystem
(
'ZServer HTTPServer'
)
...
...
@@ -382,6 +384,58 @@ class zhttp_server(http_server):
channel_class
=
zhttp_channel
def
__init__
(
self
,
ip
,
port
,
resolver
=
None
,
logger_object
=
None
):
self
.
ip
=
ip
self
.
port
=
port
asyncore
.
dispatcher
.
__init__
(
self
)
self
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
handlers
=
[]
if
not
logger_object
:
logger_object
=
logger
.
file_logger
(
sys
.
stdout
)
self
.
set_reuse_addr
()
self
.
bind
((
ip
,
port
))
# lower this to 5 if your OS complains
self
.
listen
(
1024
)
host
,
port
=
self
.
socket
.
getsockname
()
if
not
ip
:
ip
=
socket
.
gethostbyname
(
socket
.
gethostname
())
try
:
self
.
server_name
=
socket
.
gethostbyaddr
(
ip
)[
0
]
except
socket
.
error
:
self
.
log_info
(
'Cannot do reverse lookup for server address'
,
'warning'
)
self
.
server_name
=
ip
# use the IP address as the "hostname"
self
.
server_port
=
port
self
.
total_clients
=
counter
.
counter
()
self
.
total_requests
=
counter
.
counter
()
self
.
exceptions
=
counter
.
counter
()
self
.
bytes_out
=
counter
.
counter
()
self
.
bytes_in
=
counter
.
counter
()
if
not
logger_object
:
logger_object
=
logger
.
file_logger
(
sys
.
stdout
)
if
resolver
:
self
.
logger
=
logger
.
resolving_logger
(
resolver
,
logger_object
)
else
:
self
.
logger
=
logger
.
unresolving_logger
(
logger_object
)
self
.
log_info
(
'HTTP server (V%s) started at %s
\
n
'
'
\
t
Server URL: http://%s:%s/
\
n
'
%
(
VERSION_STRING
,
time
.
ctime
(
time
.
time
()),
self
.
server_name
,
port
,
)
)
def
readable
(
self
):
return
self
.
accepting
and
\
len
(
asyncore
.
socket_map
)
<
CONNECTION_LIMIT
...
...
lib/python/ZServer/HTTPServer.py
View file @
f5553ba2
...
...
@@ -110,13 +110,14 @@ import os
import
types
import
thread
import
time
import
socket
from
cStringIO
import
StringIO
from
PubCore
import
handle
from
HTTPResponse
import
make_response
from
ZPublisher.HTTPRequest
import
HTTPRequest
from
medusa.http_server
import
http_server
,
http_channel
from
medusa.http_server
import
http_server
,
http_channel
,
VERSION_STRING
from
medusa
import
counter
,
producers
,
asyncore
,
max_sockets
from
medusa.default_handler
import
split_path
,
unquote
,
get_header
from
medusa.asyncore
import
compact_traceback
,
dispatcher
...
...
@@ -125,6 +126,7 @@ from ZServer import CONNECTION_LIMIT, ZOPE_VERSION, ZSERVER_VERSION
from
zLOG
import
LOG
,
register_subsystem
,
BLATHER
,
INFO
,
WARNING
,
ERROR
import
DebugLogger
from
medusa
import
logger
register_subsystem
(
'ZServer HTTPServer'
)
...
...
@@ -382,6 +384,58 @@ class zhttp_server(http_server):
channel_class
=
zhttp_channel
def
__init__
(
self
,
ip
,
port
,
resolver
=
None
,
logger_object
=
None
):
self
.
ip
=
ip
self
.
port
=
port
asyncore
.
dispatcher
.
__init__
(
self
)
self
.
create_socket
(
socket
.
AF_INET
,
socket
.
SOCK_STREAM
)
self
.
handlers
=
[]
if
not
logger_object
:
logger_object
=
logger
.
file_logger
(
sys
.
stdout
)
self
.
set_reuse_addr
()
self
.
bind
((
ip
,
port
))
# lower this to 5 if your OS complains
self
.
listen
(
1024
)
host
,
port
=
self
.
socket
.
getsockname
()
if
not
ip
:
ip
=
socket
.
gethostbyname
(
socket
.
gethostname
())
try
:
self
.
server_name
=
socket
.
gethostbyaddr
(
ip
)[
0
]
except
socket
.
error
:
self
.
log_info
(
'Cannot do reverse lookup for server address'
,
'warning'
)
self
.
server_name
=
ip
# use the IP address as the "hostname"
self
.
server_port
=
port
self
.
total_clients
=
counter
.
counter
()
self
.
total_requests
=
counter
.
counter
()
self
.
exceptions
=
counter
.
counter
()
self
.
bytes_out
=
counter
.
counter
()
self
.
bytes_in
=
counter
.
counter
()
if
not
logger_object
:
logger_object
=
logger
.
file_logger
(
sys
.
stdout
)
if
resolver
:
self
.
logger
=
logger
.
resolving_logger
(
resolver
,
logger_object
)
else
:
self
.
logger
=
logger
.
unresolving_logger
(
logger_object
)
self
.
log_info
(
'HTTP server (V%s) started at %s
\
n
'
'
\
t
Server URL: http://%s:%s/
\
n
'
%
(
VERSION_STRING
,
time
.
ctime
(
time
.
time
()),
self
.
server_name
,
port
,
)
)
def
readable
(
self
):
return
self
.
accepting
and
\
len
(
asyncore
.
socket_map
)
<
CONNECTION_LIMIT
...
...
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