common/src/main/java/HTTPClient/Response.java
/**
     * Parses the given lines as header fields of the form "<name>: <value>"
     * into the given list.
     *
     * @param lines the header or trailer lines, one header field per line
     * @param list  the Hashtable to store the parsed fields in
     * @exception ProtocolException if any part of the headers do not
     *                              conform
     */
Parses the given lines as header fields of the form ": "
into the given list.

@param lines the header or trailer lines, one header field per line
@param list  the Hashtable to store the parsed fields in
@exception ProtocolException if any part of the headers do not
conform
Parses the given lines as header fields of the form " : " into the given list . @param lines the header or trailer lines one header field per line @param list the Hashtable to store the parsed fields in @exception ProtocolException if any part of the headers do not conform
private void parseHeaderFields(StringTokenizer lines, CIHashtable list)
	    throws ProtocolException
    {
	while (lines.hasMoreTokens())
	{
	    String hdr = lines.nextToken();
	    int    sep = hdr.indexOf(':');
	    /* Once again we have to deal with broken servers and try
	     * to wing it here. If no ':' is found, try using the first
	     * space:
	     */
	    if (sep == -1)
		sep = hdr.indexOf(' ');
	    if (sep == -1)
	    {
		throw new ProtocolException("Invalid HTTP header received: " +
					    hdr);
	    }
	    String hdr_name  = hdr.substring(0, sep).trim();
	    String hdr_value = hdr.substring(sep+1).trim();
	    if (!singleValueHeaders.containsKey(hdr_name.toLowerCase()))
	    {
		String old_value  = (String) list.get(hdr_name);
		if (old_value == null)
		    list.put(hdr_name, hdr_value);
		else
		    list.put(hdr_name, old_value + ", " + hdr_value);
	    }
	    else
		list.put(hdr_name, hdr_value);
	}
    }
private void parseHeaderFields ( StringTokenizer lines , CIHashtable list ) throws ProtocolException { while ( lines . hasMoreTokens ( ) ) { String hdr = lines . nextToken ( ) ; int sep = hdr . indexOf ( ':' ) ; /* Once again we have to deal with broken servers and try
	     * to wing it here. If no ':' is found, try using the first
	     * space:
	     */ if ( sep == - 1 ) sep = hdr . indexOf ( ' ' ) ; if ( sep == - 1 ) { throw new ProtocolException ( "Invalid HTTP header received: " + hdr ) ; } String hdr_name = hdr . substring ( 0 , sep ) . trim ( ) ; String hdr_value = hdr . substring ( sep + 1 ) . trim ( ) ; if ( ! singleValueHeaders . containsKey ( hdr_name . toLowerCase ( ) ) ) { String old_value = ( String ) list . get ( hdr_name ) ; if ( old_value == null ) list . put ( hdr_name , hdr_value ) ; else list . put ( hdr_name , old_value + ", " + hdr_value ) ; } else list . put ( hdr_name , hdr_value ) ; } }
Parses the given lines as header fields of the form "<name>: <value>"
 into the given list.
Parses the given lines as header fields of the form " <name > : <value > " into the given list .
// Can header have multiple values? // No multiple values--just replace/put latest header value