     // normally be in the bundle
     func debugFrom(URL: NSURL?) {
         debugURL = URL
+        for mw in middleware {
+            if let fmw = mw as? BRHTTPFileMiddleware {
+                fmw.debugURL = URL
+            }
+        }
     }
     
     func start(port: in_port_t = 8888, maxPendingConnections: Int32 = SOMAXCONN) throws {

    case InvalidRangeHeader
}

@objc public class BRHTTPServer: NSObject {
    var fd: Int32 = -1
    var clients: Set<Int32> = []
    var path: NSURL
    var debugURL: NSURL?
    
    init(baseDirectory: NSURL) {
        path = baseDirectory
        super.init()
    }
    

        }
    }
    
    private func dispatch(req: BRHTTPRequest) throws {
        var responseSent = false
        var request = req
        for m in middleware {
            let resp = m.handle(request)
            if let httpResp = resp.response {
                do {
                    try httpResp.send()
                } catch let e {
                    print("[BRHTTPServer] error sending response. request: \(req) error: \(e)")
                }
                responseSent = true
                break
            } else {
                request = resp.request // allow middleware to mutate request
            }
        }
        if !responseSent {
            // send a 404 or something
            print("[BRHTTPServer] did not send a response")
        }
    }
    
    private static func detectContentType(URL url: NSURL) -> String {
