             true
         
         INIT_REQUEST: ->
-            console.log "init request"
             @state = "REQUEST_LINE"
             @lineState = "DATA"
             @info = headers:{}

            # cool, now make sure we have the headers we need

            # first, make sure the authorization header contains the right password
            if info.headers.authorization && @_authorize(stream,info.headers.authorization)
                sock.write "HTTP/1.0 200 OK\n\n"

                # now create a new source
                source = new (require "../sources/icecast") stream, sock, info.headers
                stream.addSource source
            else
                sock.write "HTTP/1.0 401 Unauthorized\r\n"
                sock.end "Invalid source or password.\r\n"

        else
            sock.write "HTTP/1.0 401 Unauthorized\r\n"
            sock.end "Invalid source or password.\r\n"
            

module.exports = class SourceIn extends require("events").EventEmitter
    constructor: (opts) ->
        @core = opts.core
        
        @log = @core.log.child mode:"sourcein"
        
        # grab our listening port
        @port = opts.port
