# Path: chirp/stream/looper.py
# class Looper(object):
#     MAX_TRAPPED_EXCEPTIONS = 100
#     def __init__(self):
#     def _begin_looping(self):
#     def _loop_once(self):
#     def _done_looping(self):
#     def _trap_exceptions(self, callable_to_wrap):
#     def loop(self):
#     def stop(self):
#     def loop_in_thread(self):
#     def wait(self):
#     def wait_until_looped_once(self):
# 
# Path: chirp/stream/message.py
# CONNECTED = "Connected"        # New connection initiated.
# RESPONSE = "Response"          # HTTP response received.
# BLOCK = "Block"                # A chunk of raw data.
# FRAME = "Frame"                # An MP3 frame.
# ERROR = "Error"                # An error.
# CONNECT_TIMEOUT_ERROR = "Connect Timeout Error"
# CONNECT_ERROR = "Connect Error"
# REQUEST_ERROR = "Request Error"
# READ_TIMEOUT_ERROR = "Read Timeout Error"
# READ_ERROR = "Read Error"
# MISSING_HEADERS_ERROR = "Missing HTTP Headers Error"
# MALFORMED_HEADERS_ERROR = "Malformed HTTP Headers Error"
# BAD_REDIRECT_ERROR = "Bad Redirect Error"
# END_OF_STREAM_ERROR = "End of Stream Error"
# class Message(object):
# class MessageSource(object):
# class MessageConsumer(looper.Looper):
# class MessageTee(MessageConsumer):
#     def payload_sha1(self):
#     def payload_hex_sha1(self):
#     def __str__(self):
#     def set_error(self, error_type, err):
#     def is_error(self):
#     def is_end_of_stream(self):
#     def __init__(self):
#     def _add_message(self, msg):
#     def _add_stop_message(self):
#     def get_next_message(self, timeout=None):
#     def get_all_messages(self):
#     def wait_until_empty(self):
#     def __init__(self, src):
#     def _process_message(self, msg):
#     def _loop_once(self):
#     def __init__(self, input_src, num_outputs):
#     def _process_message(self, msg):


import Queue
import socket
import SocketServer
import threading
from chirp.stream import looper
from chirp.stream import message
                return
            print request_str
            if "\r\n\r\n" in request_str:
                break
        # Queue up the response headers that we will send back.
        self.send(_RESPONSE_HEADERS)
        # Register to receieve messages from the HttpProxy object.
        self.server.proxy.register(self)
        # Now pull data from the queue and send it back to the
        # newly-connected client.
        while True:
            data = self._data_queue.get()
            # 'None' is a sentinal value that tells us the server is
            # shutting down.
            if data is None:
                break
            try:
                _send_all(self.request, data)
            except socket.error, err:
                # Drop the connection on an error.
                self.server.proxy.dropped_connections += 1
                return


class _ServerLooper(looper.Looper):
    """A looper for handling incoming requests to a server."""

    _TIMEOUT_S = 0.5

    def __init__(self, host, port):

# Path: chirp/stream/looper.py
# class Looper(object):
#     MAX_TRAPPED_EXCEPTIONS = 100
#     def __init__(self):
#     def _begin_looping(self):
#     def _loop_once(self):
#     def _done_looping(self):
#     def _trap_exceptions(self, callable_to_wrap):
#     def loop(self):
#     def stop(self):
#     def loop_in_thread(self):
#     def wait(self):
#     def wait_until_looped_once(self):
# 
# Path: chirp/stream/message.py
# CONNECTED = "Connected"        # New connection initiated.
# RESPONSE = "Response"          # HTTP response received.
# BLOCK = "Block"                # A chunk of raw data.
# FRAME = "Frame"                # An MP3 frame.
# ERROR = "Error"                # An error.
# CONNECT_TIMEOUT_ERROR = "Connect Timeout Error"
# CONNECT_ERROR = "Connect Error"
# REQUEST_ERROR = "Request Error"
# READ_TIMEOUT_ERROR = "Read Timeout Error"
# READ_ERROR = "Read Error"
# MISSING_HEADERS_ERROR = "Missing HTTP Headers Error"
# MALFORMED_HEADERS_ERROR = "Malformed HTTP Headers Error"
# BAD_REDIRECT_ERROR = "Bad Redirect Error"
# END_OF_STREAM_ERROR = "End of Stream Error"
# class Message(object):
# class MessageSource(object):
# class MessageConsumer(looper.Looper):
# class MessageTee(MessageConsumer):
#     def payload_sha1(self):
#     def payload_hex_sha1(self):
#     def __str__(self):
#     def set_error(self, error_type, err):
#     def is_error(self):
#     def is_end_of_stream(self):
#     def __init__(self):
#     def _add_message(self, msg):
#     def _add_stop_message(self):
#     def get_next_message(self, timeout=None):
#     def get_all_messages(self):
#     def wait_until_empty(self):
#     def __init__(self, src):
#     def _process_message(self, msg):
#     def _loop_once(self):
#     def __init__(self, input_src, num_outputs):
#     def _process_message(self, msg):


# Path: chirp/stream/http_proxy.py
import Queue
import socket
import SocketServer
import threading
from chirp.stream import looper
from chirp.stream import message

                return
            print request_str
            if "\r\n\r\n" in request_str:
                break
        # Queue up the response headers that we will send back.
        self.send(_RESPONSE_HEADERS)
        # Register to receieve messages from the HttpProxy object.
        self.server.proxy.register(self)
        # Now pull data from the queue and send it back to the
        # newly-connected client.
        while True:
            data = self._data_queue.get()
            # 'None' is a sentinal value that tells us the server is
            # shutting down.
            if data is None:
                break
            try:
                _send_all(self.request, data)
            except socket.error, err:
                # Drop the connection on an error.
                self.server.proxy.dropped_connections += 1
                return


class _ServerLooper(looper.Looper):
    """A looper for handling incoming requests to a server."""

    _TIMEOUT_S = 0.5

    def __init__(self, host, port):

        looper.Looper.__init__(self)