def status(self): # Thanks to [email protected] (Mike Meyer) r = [ producers.simple_producer('<li>Authorization Extension : ' '<b>Unauthorized requests:</b> %s<ul>' % self.fail_count) ] if hasattr(self.handler, 'status'): r.append(self.handler.status()) r.append(producers.simple_producer('</ul>')) return producers.composite_producer(http_server.fifo(r))
def status (self): # Thanks to [email protected] (Mike Meyer) r = [ producers.simple_producer ( '<li>Authorization Extension : ' '<b>Unauthorized requests:</b> %s<ul>' % self.fail_count ) ] if hasattr (self.handler, 'status'): r.append (self.handler.status()) r.append ( producers.simple_producer ('</ul>') ) return producers.composite_producer(r)
def status (self): return producers.simple_producer ( '<li>Bobo Handler' + '<ul>' + ' <li><b>Hits:</b> %d' % int(self.hits) + '</ul>' )
def status(self): import producers return producers.simple_producer( '<li> Redirecting Handler %s => %s <b>Hits</b>: %s' % ( self.pattern, self.redirect, self.hits ) )
def status (self): import producers return producers.simple_producer ( '<li> Redirecting Handler %s => %s <b>Hits</b>: %s' % ( self.pattern, self.redirect, self.hits ) )
def status (self): def nice_bytes (n): return string.join (status_handler.english_bytes (n)) handler_stats = filter (None, map (maybe_status, self.handlers)) if self.total_clients: ratio = self.total_requests.as_long() / float(self.total_clients.as_long()) else: ratio = 0.0 return producers.composite_producer ( fifo ([producers.lines_producer ( ['<h2>%s</h2>' % self.SERVER_IDENT, '<br>Listening on: <b>Host:</b> %s' % self.server_name, '<b>Port:</b> %d' % self.port, '<p><ul>' '<li>Total <b>Clients:</b> %s' % self.total_clients, '<b>Requests:</b> %s' % self.total_requests, '<b>Requests/Client:</b> %.1f' % (ratio), '<li>Total <b>Bytes In:</b> %s' % (nice_bytes (self.bytes_in.as_long())), '<b>Bytes Out:</b> %s' % (nice_bytes (self.bytes_out.as_long())), '<li>Total <b>Exceptions:</b> %s' % self.exceptions, '</ul><p>' '<b>Extension List</b><ul>', ])] + handler_stats + [producers.simple_producer('</ul>')] ) )
def status (self): def nice_bytes (n): return string.join (status_handler.english_bytes (n)) handler_stats = filter (None, map (maybe_status, self.handlers)) if self.total_clients: ratio = self.total_requests.as_long() / float(self.total_clients.as_long()) else: ratio = 0.0 return producers.composite_producer ( [producers.lines_producer ( ['<h2>%s</h2>' % self.SERVER_IDENT, '<br>Listening on: <b>Host:</b> %s' % self.server_name, '<b>Port:</b> %d' % self.port, '<p><ul>' '<li>Total <b>Clients:</b> %s' % self.total_clients, '<b>Requests:</b> %s' % self.total_requests, '<b>Requests/Client:</b> %.1f' % (ratio), '<li>Total <b>Bytes In:</b> %s' % (nice_bytes (self.bytes_in.as_long())), '<b>Bytes Out:</b> %s' % (nice_bytes (self.bytes_out.as_long())), '<li>Total <b>Exceptions:</b> %s' % self.exceptions, '</ul><p>' '<b>Extension List</b><ul>', ])] + handler_stats + [producers.simple_producer('</ul>')] )
def status (self): return producers.simple_producer ( '<h2>%s</h2>' % self.SERVER_IDENT + '<br><b>Total Sessions:</b> %s' % self.total_sessions + '<br><b>Current Sessions:</b> %d' % ( self.total_sessions.as_long()-self.closed_sessions.as_long() ) )
def status (self): return producers.simple_producer ( '<li>Server-Side Script Handler' + '<ul>' + ' <li><b>Hits:</b> %s' % self.hits + ' <li><b>Exceptions:</b> %s' % self.exceptions + '</ul>' )
def status (self): return producers.simple_producer ( '<li>%s' % status_handler.html_repr (self) + '<ul>' + ' <li><b>Total Hits:</b> %s' % self.hit_counter + ' <li><b>Files Delivered:</b> %s' % self.file_counter + ' <li><b>Cache Hits:</b> %s' % self.cache_counter + '</ul>' )
def status (self): return producers.simple_producer ( '<li>%s' % status_handler.html_repr (self) + '<ul>' + ' <li><b>Total Commands:</b> %s' % self.commandCounter + ' <li><b>Completed:</b> %s' % self.completedCounter + ' <li><b>Exceptions:</b> %s' % self.exceptionsCounter + '</ul>' )
def status(self): import producers return producers.simple_producer( '<h2>%s</h2>' % self.SERVER_IDENT + '<br>Server: %s' % self.server + '<br>Cache Entries: %d' % len(self.cache) + '<br>Outstanding Requests: %d' % len(self.request_map) + '<br>Forward Requests: %s' % self.forward_requests + '<br>Reverse Requests: %s' % self.reverse_requests + '<br>Cache Hits: %s' % self.cache_hits)
def status (self): import producers return producers.simple_producer ( '<h2>%s</h2>' % self.SERVER_IDENT + '<br>Server: %s' % self.server + '<br>Cache Entries: %d' % len(self.cache) + '<br>Outstanding Requests: %d' % len(self.request_map) + '<br>Forward Requests: %s' % self.forward_requests + '<br>Reverse Requests: %s' % self.reverse_requests + '<br>Cache Hits: %s' % self.cache_hits )
def status(self): import status_handler import producers return producers.simple_producer( "<h2>%s</h2>" % self.SERVER_IDENT + "<br>Server: %s" % self.server + "<br>Cache Entries: %d" % len(self.cache) + "<br>Outstanding Requests: %d" % len(self.request_map) + "<br>Forward Requests: %s" % self.forward_requests + "<br>Reverse Requests: %s" % self.reverse_requests + "<br>Cache Hits: %s" % self.cache_hits )
def push(self, thing): if type(thing) == type(""): self.outgoing.append(producers.simple_producer(thing)) else: self.outgoing.append(thing)
def push (self, thing): if type(thing) == type(''): self.outgoing.push (producers.simple_producer (thing)) else: self.outgoing.push (thing)
def done (self): "finalize this transaction - send output to the http channel" # ---------------------------------------- # persistent connection management # ---------------------------------------- # --- BUCKLE UP! ---- connection = string.lower (get_header (CONNECTION, self.header)) close_it = 0 wrap_in_chunking = 0 if self.version == '1.0': if connection == 'keep-alive': if not self.has_key ('Content-Length'): close_it = 1 else: self['Connection'] = 'Keep-Alive' else: close_it = 1 elif self.version == '1.1': if connection == 'close': close_it = 1 elif not self.has_key ('Content-Length'): if self.has_key ('Transfer-Encoding'): if not self['Transfer-Encoding'] == 'chunked': close_it = 1 elif self.use_chunked: self['Transfer-Encoding'] = 'chunked' wrap_in_chunking = 1 else: close_it = 1 elif self.version is None: # Although we don't *really* support http/0.9 (because we'd have to # use \r\n as a terminator, and it would just yuck up a lot of stuff) # it's very common for developers to not want to type a version number # when using telnet to debug a server. close_it = 1 outgoing_header = producers.simple_producer (self.build_reply_header()) if close_it: self['Connection'] = 'close' if wrap_in_chunking: outgoing_producer = producers.chunked_producer ( producers.composite_producer (self.outgoing) ) # prepend the header outgoing_producer = producers.composite_producer ( fifo([outgoing_header, outgoing_producer]) ) else: # prepend the header self.outgoing.push_front (outgoing_header) outgoing_producer = producers.composite_producer (self.outgoing) # apply a few final transformations to the output self.channel.push_with_producer ( # globbing gives us large packets producers.globbing_producer ( # hooking lets us log the number of bytes sent producers.hooked_producer ( outgoing_producer, self.log ) ) ) self.channel.current_request = None if close_it: self.channel.close_when_done()
def status (self): return producers.simple_producer ( '<li>Status Extension <b>Hits</b> : %s' % self.hit_counter )
def status(self): return producers.simple_producer( '<li>%s' % status_handler.html_repr(self) + '<ul>' + ' <li><b>Total Hits:</b> %s' % self.hit_counter + ' <li><b>Files Delivered:</b> %s' % self.file_counter + ' <li><b>Cache Hits:</b> %s' % self.cache_counter + '</ul>')
def status(self): return producers.simple_producer('<li>Server-Side Script Handler' + '<ul>' + ' <li><b>Hits:</b> %s' % self.hits + ' <li><b>Exceptions:</b> %s' % self.exceptions + '</ul>')
def done (self): "finalize this transaction - send output to the http channel" # ---------------------------------------- # persistent connection management # ---------------------------------------- # --- BUCKLE UP! ---- connection = string.lower (get_header (CONNECTION, self.header)) close_it = 0 wrap_in_chunking = 0 if self.version == '1.0': if connection == 'keep-alive': if not self.has_key ('Content-Length'): close_it = 1 else: self['Connection'] = 'Keep-Alive' else: close_it = 1 elif self.version == '1.1': if connection == 'close': close_it = 1 elif not self.has_key ('Content-Length'): if self.has_key ('Transfer-Encoding'): if not self['Transfer-Encoding'] == 'chunked': close_it = 1 elif self.use_chunked: self['Transfer-Encoding'] = 'chunked' wrap_in_chunking = 1 else: close_it = 1 elif self.version is None: # Although we don't *really* support http/0.9 (because we'd have to # use \r\n as a terminator, and it would just yuck up a lot of stuff) # it's very common for developers to not want to type a version number # when using telnet to debug a server. close_it = 1 outgoing_header = producers.simple_producer(self.get_reply_header_text()) if close_it: self['Connection'] = 'close' if wrap_in_chunking: outgoing_producer = producers.chunked_producer ( producers.composite_producer (self.outgoing) ) # prepend the header outgoing_producer = producers.composite_producer( [outgoing_header, outgoing_producer] ) else: # prepend the header self.outgoing.insert(0, outgoing_header) outgoing_producer = producers.composite_producer (self.outgoing) # apply a few final transformations to the output self.channel.push_with_producer ( # globbing gives us large packets producers.globbing_producer ( # hooking lets us log the number of bytes sent producers.hooked_producer ( outgoing_producer, self.log ) ) ) self.channel.current_request = None if close_it: self.channel.close_when_done()
def push (self, thing): if type(thing) == type(''): self.outgoing.append(producers.simple_producer(thing, buffer_size=len(thing))) else: self.outgoing.append(thing)
def status (self): import producers return producers.simple_producer ( '<li> RSS Subscription Handler')