<commit_before>//
//  HttpStringUtils.swift
//
//  Copyright ©2016 <NAME>. This file is licensed under the ISC license.
//

import Foundation

public struct HttpHeaders: Equatable {
	public let statusCode: Int
	public let httpVersion: String
	public let headers: [String: String]
	public let isChunked: Bool

	public init(statusCode: Int, httpVersion: String, headers: [String: String]) {
		self.statusCode = statusCode
		self.httpVersion = httpVersion
		self.headers = headers
		isChunked = headers["Transfer-Encoding"] == "chunked"
	}
	
	public static func == (lhs: HttpHeaders, rhs: HttpHeaders) -> Bool {
		return lhs.statusCode == rhs.statusCode &&
			lhs.httpVersion == rhs.httpVersion &&
			lhs.headers == rhs.headers
	}
}

public class HttpStringUtils {
	public enum UtilError: Error {
		case invalidInput
	}
<commit_msg>HttpHeaders now pre-parses the content-length header<commit_after>//
//  HttpStringUtils.swift
//
//  Copyright ©2016 <NAME>. This file is licensed under the ISC license.
//

import Foundation

public struct HttpHeaders: Equatable {
	public let statusCode: Int
	public let httpVersion: String
	public let headers: [String: String]
	public let isChunked: Bool
	public let contentLength: Int?

	public init(statusCode: Int, httpVersion: String, headers: [String: String]) {
		self.statusCode = statusCode
		self.httpVersion = httpVersion
		self.headers = headers
		isChunked = headers["Transfer-Encoding"] == "chunked"
		if let lengthStr = headers["Content-Length"] {
			contentLength = Int(lengthStr)
		} else {
			contentLength = nil
		}
	}
	
	public static func == (lhs: HttpHeaders, rhs: HttpHeaders) -> Bool {
		return lhs.statusCode == rhs.statusCode &&
			lhs.httpVersion == rhs.httpVersion &&
			lhs.headers == rhs.headers
	}
}

public class HttpStringUtils {
	public enum UtilError: Error {
		case invalidInput
	}

{'fraction_non_alphanumeric': 0.10486486486486486, 'fraction_numerical': 0.004324324324324324, 'mean_word_length': 4.057377049180328, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1341585', 'n_tokens_mistral': 598, 'n_tokens_neox': 552, 'n_words': 172}