Actually, it should be

 if ( ( (NULL != client_requested_close) ||
  (MHD_YES == connection->read_closed) ) &&
  (NULL == response_has_close) &&
  (0 == (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
    must_add_close = MHD_YES;

(As in, if the flag is *not* set, we should add Connection: Close).

Fixed in SVN 35530, thanks for reporting!

Happy hacking!

Christian

On 04/10/2015 05:21 PM, [email protected] wrote:
> Hi,
> 
> There is a change of behavior between 0.9.37 and 0.9.38.
> When a client adds a "Connection: close" header in 0.9.37, MHD adds a 
> "Connection: close" header to its response and then 
> close the connection (as suggested in rfc2616, section 8.1.2.1).
> The "Connection: close" header is not added in 0.9.38.
> I looked into the 0.9.38 code and the code that prevents the inclusion of the 
> "Connection: close" header is at line 773 of connection.c.
>  if ( ( (NULL != client_requested_close) ||
>  (MHD_YES == connection->read_closed) ) &&
>  (NULL == response_has_close) &&
>  (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) )
>  must_add_close = MHD_YES;
> 
> Shouldn't it read
>  if ( ( (NULL != client_requested_close) ||
>  (MHD_YES == connection->read_closed) ||
>  (0 != (connection->response->flags & MHD_RF_HTTP_VERSION_1_0_ONLY) ) ) &&
>  (NULL == response_has_close) )
>  must_add_close = MHD_YES;
> 
> Thanks,
> 
> Louis Benoit
> 

Reply via email to