             content_length  = srcResp.headers['content-length']
 
             if content_length > 5242880
-              four_oh_four("Content-Length exceeded")
+              four_oh_four(resp, "Content-Length exceeded")
             else
               newHeaders =
                 'expires'                : srcResp.headers['expires']

                  resp.writeHead srcResp.statusCode, newHeaders

                else
                  four_oh_four("Responded with #{srcResp.statusCode}:#{srcResp.headers}")

          srcReq.on 'error', ->
            decr()
            resp.end()

          srcReq.end()

        else
          four_oh_four("No host found #{url.host}")
      else
        four_oh_four("checksum mismatch #{hmac_digest}:#{query_digest}")
    else
      four_oh_four("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}"

                'X-Content-Type-Options' : 'nosniff'

              srcResp.on 'end', ->
                finish resp

              srcResp.on 'error', ->
                finish resp

              switch srcResp.statusCode
                when 200
                  if newHeaders['content-type'] && newHeaders['content-type'].slice(0, 5) != 'image'
                    four_oh_four(resp, "Non-Image content-type returned")

                  log newHeaders

