src/HTTPRequestHandler.java
private String readRequestFromClient() throws IOException {
		boolean postFlag = false;
		String ret_read;
		StringBuilder requestHeaders = new StringBuilder();
		BufferedReader inputStream = new BufferedReader(new InputStreamReader(m_Socket.getInputStream()));
        while (!(ret_read = inputStream.readLine()).equals("")) {
        	if (ret_read.startsWith("POST")) {
        		postFlag = true;
        	}
        	requestHeaders.append(ret_read);
        	requestHeaders.append(CRLF);
        }
        if (postFlag) {
        	requestHeaders.append(CRLF);
        	while(inputStream.ready()) {
        		requestHeaders.append((char) inputStream.read());
        	}
        }
                
        System.out.println(requestHeaders);
		return requestHeaders.toString();
	}
/*
	 * Read the request from the client
	 */
Read the request from the client
Read the request from the client
private String readRequestFromClient() throws IOException {
		boolean postFlag = false;
		String ret_read;
		StringBuilder requestHeaders = new StringBuilder();
		BufferedReader inputStream = new BufferedReader(new InputStreamReader(m_Socket.getInputStream()));
        while (!(ret_read = inputStream.readLine()).equals("")) {
        	if (ret_read.startsWith("POST")) {
        		postFlag = true;
        	}
        	requestHeaders.append(ret_read);
        	requestHeaders.append(CRLF);
        }
        if (postFlag) {
        	requestHeaders.append(CRLF);
        	while(inputStream.ready()) {
        		requestHeaders.append((char) inputStream.read());
        	}
        }
        System.out.println(requestHeaders);
		return requestHeaders.toString();
	}
private String readRequestFromClient ( ) throws IOException { boolean postFlag = false ; String ret_read ; StringBuilder requestHeaders = new StringBuilder ( ) ; BufferedReader inputStream = new BufferedReader ( new InputStreamReader ( m_Socket . getInputStream ( ) ) ) ; while ( ! ( ret_read = inputStream . readLine ( ) ) . equals ( "" ) ) { if ( ret_read . startsWith ( "POST" ) ) { postFlag = true ; } requestHeaders . append ( ret_read ) ; requestHeaders . append ( CRLF ) ; } if ( postFlag ) { requestHeaders . append ( CRLF ) ; while ( inputStream . ready ( ) ) { requestHeaders . append ( ( char ) inputStream . read ( ) ) ; } } System . out . println ( requestHeaders ) ; return requestHeaders . toString ( ) ; }
Read the request from the client
Read the request from the client