Ev, I like all your explanations! :-)
I tested Node and it doesn't send any Connection header too, but I don't know why. BTW, I'm going to use as HTTP standards defines, but the `MHD_OPTION_CONNECTION_HEADER, "keep-alive",` would be very nice in some case like this: === the MHD initialization === MHD_OPTION_CONNECTION_HEADER, iif(SomeOwnObject.KeepAlive, "Keep-Alive", "Close"), === the MHD initialization === It would define the default connection type (keep-alive or close) of all requests. :-) On Sat, Jan 23, 2016 at 7:55 AM, Evgeny Grin <[email protected]> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > On 22.01.2016 20:27, silvioprog wrote: > > Is there some link where I can get it? I need this one to document it in > > my framework that uses MHD. > https://tools.ietf.org/html/rfc7230#page-52 > - --- begin --- > A client that does not support persistent connections MUST send the > "close" connection option in every request message. > > A server that does not support persistent connections MUST send the > "close" connection option in every response message that does not > have a 1xx (Informational) status code. > - --- end --- > > https://tools.ietf.org/html/rfc7230#page-52 > - --- begin --- > o If the "close" connection option is present, the connection will > not persist after the current response; else, > > o If the received protocol is HTTP/1.1 (or later), the connection > will persist after the current response; else, > ... > - --- end --- > So, if "Connection: " header is not present and protocol is HTTP/1.1 or > later, the connection must be persistent. > > For better compatibility with older client MHD always add "Connection: > Keep-Alive" if persistent connection is used. > > > I saw all headers from popular sites like Google > > <https://img42.com/dLL1P> and Facebook <https://img42.com/pUMyc>, and I > > didn't see the connection header. :-/ But it isn't a problem, because > > this sites uses HTTP 2.0, and I don't know if this one needs the > > connection header. > > > > BTW, it would be nice if the keep-alive/close value in the header could > > be chosen via some initialization flag, something like this: > > > > daemon = > > MHD_start_daemon(MHD_USE_SELECT_INTERNALLY, PORT, NULL, NULL, &hr, > NULL, > > MHD_OPTION_CONNECTION_HEADER, "keep-alive", > > MHD_OPTION_END); > It can be implemented, but close connection will waste system resources > as clients will repeatedly disconnect/connect to server. Better use > reasonable timeout value. > > > > Avoiding to handle it directly in the user callback request. And more: > > > > (No declaration) -- uses MHD default, that's keep-alive > > MHD_OPTION_CONNECTION_HEADER, "keep-alive", -- set keep-alive > > MHD_OPTION_CONNECTION_HEADER, "close", -- set close > > MHD_OPTION_CONNECTION_HEADER, NULL, -- undeclares Connection header, > > so the programmer do it by own risk > > > > What do you think? :-) > Without connection header, connection must be persistent for HTTP/1.1 > (and later) and must be closed for HTTP/1.0. > "keep-alive" is not MHD's default, it's HTTP default. > "Connection" header allow to explicitly signal to client connection > mode, I can't see advantages of absence such header rather than > unnoticeable traffic lowering. > > - -- > Best Wishes, > Evgeny Grin > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v2 > > iQEcBAEBCAAGBQJWo1wIAAoJEL96xKXqwrr0gSAH/15lS9c74WGUVMMivmWwLBa+ > T3ONkdwUDeBYF1vMKVXXgiBZp9bjJznYBNmwS968MzJD/jX1Km9WgcJfCtg3GcmM > 4c1ZOYChZTnq4l2NYocDdmV1xdVHCxcT1xozZ1Ew5fLOiki4SyALKJo68VlaQNks > GCkr0y3jh3JGOtWTH05U3NW1EQqAyg0k+1PfGRYCXLNEo41pXgc2L8yEpPw1Iei+ > fFB+BqHN5Sl/LFSirqFo9Km5y/MJn3DUsfX4Oal5TBkCoj7FR3d58ArL38mJKKEu > h68wv8oieCIiUhAlPvAmrXnI9WSE72BWCLaf3Sjj0cH90MrADeXYI5ZMV8u0zvE= > =zvUe > -----END PGP SIGNATURE----- > -- Silvio Clécio
