                 rawHeaders: parseState.rawHeaders,
                 body: parseState.body
             )
-            self.onRequest?(request)
+            self?.onRequest?(request)
         }
     }
     

    
}

public struct ResponseParser {
    private let parser: FullMessageParser
    
    init(onResponse: ((Response) -> Void)? = nil) {
        self.parser = FullMessageParser(type: HTTP_RESPONSE) { parseState in
            let response = Response(
                version: Version(major: parseState.version.major, minor: parseState.version.minor),
                status: Status(statusCode: parseState.statusCode),
                rawHeaders: parseState.rawHeaders,
                body: parseState.body
            )
            onResponse?(response)
        }
    }
    

typealias RawParserPointer = UnsafeMutablePointer<RawParser>

private func bridge<T : AnyObject>(_ obj : T) -> UnsafeMutablePointer<Void> {
    return Unmanaged.passUnretained(obj).toOpaque()
}

private func bridge<T : AnyObject>(_ ptr : UnsafeMutablePointer<Void>) -> T {
    return Unmanaged<T>.fromOpaque(ptr).takeUnretainedValue()
}

struct ParseError: ErrorProtocol {
    let description: String
}

public class RequestParser {
    private let parser: FullMessageParser!
    var onRequest:  ((Request) -> Void)?
    
    init(onRequest: ((Request) -> Void)? = nil) {
        self.onRequest = onRequest
        self.parser = FullMessageParser(type: HTTP_REQUEST)
        self.parser.onComplete = { [weak self] parseState in
            let request = Request(
                method: S4.Method(code: parseState.method),
                uri: try URI(parseState.uri),
