|
System | : | Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686 |
Software | : | Apache. PHP/5.3.6-13ubuntu3.10 |
ID | : | uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
|
|
Safe Mode | : | OFF |
Open_Basedir | : | OFF |
Freespace | : | 21.99 GB of 70.42 GB (31.23%) |
|
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON |
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
|
[ System Info ]
[ Processes ]
[ SQL Manager ]
[ Eval ]
[ Encoder ]
[ Mailer ]
[ Back Connection ]
[ Backdoor Server ]
[ Kernel Exploit Search ]
[ MD5 Decrypter ]
[ Reverse IP ]
[ Kill Shell ]
[ FTP Brute-Force ]
|
|
/
usr/
lib/
python2.6/
dist-packages/
setuptools/
tests/
- drwxr-xr-x
|
Viewing file: server.py (1.47 KB) -rw-r--r--Select action/file-type:  ( +) |  ( +) |  ( +) | Code ( +) | Session ( +) |  ( +) | SDB ( +) |  ( +) |  ( +) |  ( +) |  ( +) |  ( +) |
"""Basic http server for tests to simulate PyPI or custom indexes """ import urllib2 import sys from threading import Thread from BaseHTTPServer import HTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler
class IndexServer(HTTPServer): """Basic single-threaded http server simulating a package index
You can use this server in unittest like this:: s = IndexServer() s.start() index_url = s.base_url() + 'mytestindex' # do some test requests to the index # The index files should be located in setuptools/tests/indexes s.stop() """ def __init__(self): HTTPServer.__init__(self, ('', 0), SimpleHTTPRequestHandler) self._run = True
def serve(self): while True: self.handle_request() if not self._run: break
def start(self): self.thread = Thread(target=self.serve) self.thread.start()
def stop(self): """self.shutdown is not supported on python < 2.6""" self._run = False try: if sys.version > '2.6': urllib2.urlopen('http://127.0.0.1:%s/' % self.server_port, None, 5) else: urllib2.urlopen('http://127.0.0.1:%s/' % self.server_port) except urllib2.URLError: pass self.thread.join()
def base_url(self): port = self.server_port return 'http://127.0.0.1:%s/setuptools/tests/indexes/' % port
|