Httpd connection header bug

Hi,
in reference manual there is a claim that httpd is implemented based on RFC 2616. Based on chapters 2.1 and 14.10, comma-separated list of connection-tokens is allowed. This causes a problem when I want to keep the socket alive while upgrading the connection.

So, I think the following code in httpd_request:

get_persistens(HTTPVersion,ParsedHeader,ConfigDB)->
    case httpd_util:lookup(ConfigDB, keep_alive, true) of
	true->
	    case HTTPVersion of
		%%If it is version prio to 1.1 kill the conneciton
		"HTTP/1." ++ NList ->
		    case proplists:get_value("connection", ParsedHeader,
					     "keep-alive") of  
			%%if the connection is not ordered to go down
			%%let it live The keep-alive value is the
			%%older http/1.1 might be older Clients that
			%%use it.
			"keep-alive" when hd(NList) >= 49 ->
			    true;
			"close" ->
                            false;
			_Connect ->
                            false
		    end; 
		_ ->
		    false
	    end;
	_ ->
	    false
    end.

does not support comma-separated values (e.g. when connection header is “upgrade, keep-alive” get_persistens/3 returns false, but IMO it should return true. Shouldn’t we split connection header by comma and then search if there is “keep-alive” in list?

2 Likes