public static HttpRequest read(InputStream inputStream) throws Exception {
		// We will fill this object with the data from input stream and return it
		HttpRequest request = new HttpRequest();
		
		InputStreamReader inStreamReader = new InputStreamReader(inputStream);
		BufferedReader reader = new BufferedReader(inStreamReader);
		
		//First Request Line: GET /somedir/page.html HTTP/1.1
		String line = reader.readLine(); // A line ends with either a \r, or a \n, or both
		
		if(line == null) {
			throw new ProtocolException(Protocol.BAD_REQUEST_CODE, Protocol.BAD_REQUEST_TEXT);
		}
		
		// We will break this line using space as delimeter into three parts
		StringTokenizer tokenizer = new StringTokenizer(line, " ");
		
		// Error checking the first line must have exactly three elements
		if(tokenizer.countTokens() != 3) {
			throw new ProtocolException(Protocol.BAD_REQUEST_CODE, Protocol.BAD_REQUEST_TEXT);
		}
		
		request.method = tokenizer.nextToken();		// GET
		request.uri = tokenizer.nextToken();		// /somedir/page.html
		request.version = tokenizer.nextToken();	// HTTP/1.1
		
		// Rest of the request is a header that maps keys to values
		// e.g. Host: www.rose-hulman.edu
		// We will convert both the strings to lower case to be able to search later
		while(!line.equals("")) {
			// THIS IS A PATCH 
			// Instead of a string tokenizer, we are using string split
			// Lets break the line into two part with first space as a separator 
			
			// First lets trim the line to remove escape characters
			line = line.trim();
			
			// Now, get index of the first occurrence of space
			int index = line.indexOf(' ');
			
			if(index > 0 && index < line.length()-1) {
				// Now lets break the string in two parts
				String key = line.substring(0, index); // Get first part, e.g. "Host:"
				String value = line.substring(index+1); // Get the rest, e.g. "www.rose-hulman.edu"
				
				// Lets strip off the white spaces from key if any and change it to lower case
				key = key.trim().toLowerCase();
				
				// Lets also remove ":" from the key
				key = key.substring(0, key.length() - 1);
				
				// Lets strip white spaces if any from value as well
				value = value.trim();
				
				// Now lets put the key=>value mapping to the header map
				request.header.put(key, value);
			}
			
			// Processed one more line, now lets read another header line and loop
			line = reader.readLine().trim();
		}
		String contentLenghtString = request.header.get(Protocol.CONTENT_LENGTH.toLowerCase());
		int contentLength = 0;
		if(contentLenghtString != null) {
			try {
				contentLength = Integer.parseInt(contentLenghtString);
			}
			catch(Exception e){}
		}
		
		if(contentLength > 0) {	
			char[] bodytemp = new char[contentLength];
			try {
				reader.read(bodytemp);
				body = String.valueOf(bodytemp);

			}
			catch(Exception e) {
				e.printStackTrace();
			}
		}
		return request;
	}