     }
 
 
-    func toData() -> NSData {
+    public func toData() -> NSData {
         return toString().dataUsingEncoding(NSUTF8StringEncoding)!
     }
 
-    func toString() -> String {
+    public func toString() -> String {
         var strRep = "\(method) \(path) \(HTTPVersion)\r\n"
         for (key, value) in headers {
             strRep += "\(key): \(value)\r\n"

import Foundation

public class HTTPHeader {
    var HTTPVersion: String
    var method: String
    var isConnect: Bool = false
    var path: String
    var host: String
    var port: Int
    // just assume that `Content-Length` is given as of now.
    // Chunk is not supported yet.
    var contentLength: Int = 0
    var headers: [(String, String)] = []
    var rawHeader: NSData?

    init?(headerString: String) {
        let lines = headerString.componentsSeparatedByString("\r\n")
        guard lines.count > 3 else {
            return nil

        }
    }

    public func removeHeader(key: String) -> String? {
        for i in 0..<headers.count {
            if headers[i].0.caseInsensitiveCompare(key) == .OrderedSame {
                let (_, value) = headers.removeAtIndex(i)
