                   resp.writeHead srcResp.statusCode, newHeaders
 
                 else
-                  console.log("Responded with #{srcResp.statusCode}")
-                  resp.writeHead 404, { }
-                  resp.write "Not Found"
-                  resp.end()
+                  four_oh_hour("Responded with #{srcResp.statusCode}")
 
           srcReq.on 'error', ->
             resp.end()

  else
    url = Url.parse req.url

    transferred_headers =
      'Via'                    : 'Camo Asset Proxy'
      'Accept'                 : req.headers.accept
      'Accept-Encoding'        : req.headers['accept-encoding']
      'x-forwarded-for'        : req.headers['x-forwarded-for']
      'x-content-type-options' : 'nosniff'

    delete(req.headers.cookie)
    console.log("--------------------------------------------")
    console.log(req.headers)
    console.log("--------------------------------------------")

    query_digest = url.pathname.replace(/^\//, '')
    query_params = QueryString.parse(url.query)

          srcReq.end()

        else
          four_oh_hour("No host found")
      else
        four_oh_hour("checksum mismatch")
    else
      four_oh_hour("No pathname provided on the server")

console.log "SSL-Proxy running on #{port} with pid:#{process.pid}."
console.log "Using the secret key #{shared_key}"

Fs.open "tmp/camo.pid", "w", 0600, (err, fd) ->
  Fs.writeSync fd, process.pid

server.listen port
