public static HTTPRequest fromSocket(Socket client) throws IOException
	{	
		Vector<String> headerData = new Vector<String>();
		BufferedReader reader = new BufferedReader(new InputStreamReader(client.getInputStream()));
		
		while ( !reader.ready() && client.isConnected() );
		while ( client.isConnected() )
		{
			String line = reader.readLine();
			if ( line == null )
				break;
			if ( line.equals("") )
				break;
			headerData.add(line);
		}
		String postData = "";

		// Read POST data if it is available
		while ( reader.ready() )
		{
			char[] buf = new char[50];
			reader.read(buf, 0, buf.length);
			postData += new String(buf);
		}
		
		return new HTTPRequest(headerData, postData, client.getInetAddress().getHostAddress());
	}