<commit_before>package info.bowkett.joxy;

import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * Created by IntelliJ IDEA.
 * User: jbowkett
 * Date: Jul 24, 2013
 * Time: 9:48:46 PM
 * To change this template use File | Settings | File Templates.
 */
public class RequestParser {

  public Request parseRequest(String request) {
    final Map<String, String> values = new HashMap<String, String>();

    final String lines [] = request.split("\n");
    for (String line : lines) {
      parseLine(values, line);
    }
    
    return new Request(values.get("HOST"), values.get("PROXY-CONNECTION"),
      values.get("CACHE-CONTROL"), values.get("ACCEPT"), values.get("USER-AGENT"),
      values.get("ACCEPT-ENCODING"), values.get("ACCEPT-LANGUAGE"),
      values.get("COOKIE"));
  }

  private void parseLine(Map<String, String> values, String line) {
    final int firstSpaceIndex = line.indexOf(' ');
    if(firstSpaceIndex > -1){
      final String key = line.substring(0, firstSpaceIndex);
      final String value = line.substring(firstSpaceIndex +1);
      values.put(clean(key), value);
    }
  }

  /**
   * removes extraneous spaces or colons in the key
   * @param key
   * @return
   */
  private String clean(String key) {
    return key.replaceAll(" |:", "").toUpperCase();
  }
}<commit_msg>altered to the GET on the first line as the to address<commit_after>package info.bowkett.joxy;

import java.util.HashMap;
import java.util.Map;
import java.util.StringTokenizer;

/**
 * Created by IntelliJ IDEA.
 * User: jbowkett
 * Date: Jul 24, 2013
 * Time: 9:48:46 PM
 * To change this template use File | Settings | File Templates.
 */
public class RequestParser {

  public Request parseRequest(String request) {
    final Map<String, String> values = new HashMap<String, String>();

    final String lines [] = request.split("\n");
    for (String line : lines) {
      parseLine(values, line);
    }

    return new Request(values.get("GET"), values.get("PROXY-CONNECTION"),
      values.get("CACHE-CONTROL"), values.get("ACCEPT"), values.get("USER-AGENT"),
      values.get("ACCEPT-ENCODING"), values.get("ACCEPT-LANGUAGE"),
      values.get("COOKIE"));
  }

  private void parseLine(Map<String, String> values, String line) {
    final int firstSpaceIndex = line.indexOf(' ');
    if(firstSpaceIndex > -1){
      final String key = line.substring(0, firstSpaceIndex);
      final String value = line.substring(firstSpaceIndex +1);
      values.put(clean(key), value);
    }
  }

  /**
   * removes extraneous spaces or colons in the key
   * @param key
   * @return
   */
  private String clean(String key) {
    return key.replaceAll(" |:", "").toUpperCase();
  }
}
{'fraction_non_alphanumeric': 0.14212076583210603, 'fraction_numerical': 0.010309278350515464, 'mean_word_length': 3.498344370860927, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 11, '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': '4435197', 'n_tokens_mistral': 870, 'n_tokens_neox': 837, 'n_words': 225}