Changeset 1181
- Timestamp:
- 12/11/06 16:50:14 (6 years ago)
- Location:
- ccsd/trunk
- Files:
-
- 2 edited
-
crcnetd/_utils/ccsd_server.py (modified) (6 diffs)
-
scripts/ccsd-console (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
ccsd/trunk/crcnetd/_utils/ccsd_server.py
r1151 r1181 207 207 ccsd_xmlrpc.prof_dir = config_get(None, "profile_dir", \ 208 208 DEFAULT_PROFILE_DIR) 209 use_ssl = config_getboolean(None, "use_ssl", True) 209 210 210 211 # Port and logfile … … 263 264 # Pass off control to Twisted's mainloop 264 265 threadable.init() 265 reactor.listenSSL(port, server.Site(_root, logfile), \ 266 SCF(key, cert, cacert)) 266 if use_ssl: 267 reactor.listenSSL(port, server.Site(_root, logfile), \ 268 SCF(key, cert, cacert)) 269 else: 270 reactor.listenTCP(port, server.Site(_root, logfile)) 267 271 reactor.addSystemEventTrigger("before", "shutdown", shutdownHandler) 268 272 log_info("Server Started. Ready to serve requests...") … … 393 397 * Dispatches requests to the appropriate function that was earlier 394 398 registered via exportViaXMLRPC 395 """ 399 """ 400 rstart = time.time() 396 401 # We import this here to avoid a circular reference 397 402 from ccsd_session import isSessionValid, getSessionE, \ … … 417 422 prof.stop() 418 423 prof.close() 424 if self.log_times: 425 log_debug("Rendered %s in %0.3f seconds" % \ 426 (func["name"], (time.time()-rstart))) 419 427 return server.NOT_DONE_YET 420 428 … … 428 436 prof.stop() 429 437 prof.close() 438 if self.log_times: 439 log_debug("Rendered %s in %0.3f seconds" % \ 440 (func["name"], (time.time()-rstart))) 430 441 return server.NOT_DONE_YET 431 442 … … 480 491 prof.stop() 481 492 prof.close() 493 if self.log_times: 494 log_debug("Rendered %s in %0.3f seconds" % \ 495 (func["name"], (time.time()-rstart))) 482 496 return server.NOT_DONE_YET 483 497 -
ccsd/trunk/scripts/ccsd-console
r1179 r1181 32 32 # Get hostname, certificates from the commandline 33 33 if len(sys.argv) < 4: 34 sys.stderr.write("Usage: %s <server> <key> <cert>\n" %34 sys.stderr.write("Usage: %s [-S] <server> <key> <cert>\n" % 35 35 sys.argv[0]) 36 36 sys.exit(1) 37 37 38 use_ssl = True 39 if sys.argv[1] == "-S": 40 use_ssl = False 41 sys.argv[1:] = sys.argv[2:] 38 42 server = sys.argv[1] 39 43 key = sys.argv[2] … … 44 48 """XMLRPC Transport to create an HTTPS connection using client certs""" 45 49 50 def __init__(self, use_ssl=True): 51 self._use_ssl = use_ssl 52 46 53 def make_connection(self, host): 47 54 """Overrides the standard make_connection method … … 51 58 52 59 host, extra_headers, x509 = self.get_host_info(host) 53 try: 54 HTTPS = httplib.HTTPS 55 except AttributeError: 56 raise NotImplementedError( 57 "your version of httplib doesn't support HTTPS" 58 ) 60 if self._use_ssl: 61 try: 62 HTTPS = httplib.HTTPS 63 except AttributeError: 64 raise NotImplementedError( 65 "your version of httplib doesn't support HTTPS" 66 ) 67 else: 68 return HTTPS(host, None, key_file=key, cert_file=cert); 59 69 else: 60 return HTTPS(host, None, key_file=key, cert_file=cert);70 return httplib.HTTP(host, None) 61 71 62 72 def request(self, host, handler, request_body, verbose=0): 63 73 start = time.time() 64 74 rv = xmlrpclib.Transport.request(self, host, handler, request_body, verbose) 65 end = time.time() 66 sys.stdout.write("Request returned in %.4f seconds\n" % (end-start)) 75 sys.stdout.write("Request parsed in %.4f seconds\n" % (time.time()-start)) 67 76 return rv 68 77 … … 87 96 88 97 # Connect to the server 89 s = xmlrpclib.ServerProxy("https://%s/RPC2" % server, MyTransport( ))98 s = xmlrpclib.ServerProxy("https://%s/RPC2" % server, MyTransport(use_ssl)) 90 99 91 100 # Query to get the servers version, this acts as a check that a valid
Note: See TracChangeset
for help on using the changeset viewer.
