Add 'http-compression=auto' mode on the client, now used by default.
Following up on the recently added support for LZ4 compression, this patch introduces the new possible 'auto' mode for our client 'http-compression' configuration option, and starts using it by default.
The previously used default was 'http-compression=yes', and the new 'auto' mode is a small, but an important tweak to its behavior. In the new mode, the HTTP compression is still being used, but the negotiating is tweaked to favor svndiff2 with LZ4 compression when working over local networks.
The reasoning behind this is that for local networks it probably makes sense to favor compression speed of LZ4 instead of the better compression ratio from zlib-5, which has been used previously.
To separate local and wide area networks, we use the connection latency of the initial OPTIONS request obtained with serf_connection_get_latency().
* subversion/libsvn_subr/config_file.c (svn_config_ensure): Document the new default and possible values of the http-compression option.
* subversion/libsvn_ra_serf/ra_serf.h (svn_ra_serf__session_t.using_compression): Turn into a tristate field. (svn_ra_serf__session_t.conn_latency): New field. (svn_ra_serf__is_local_network): Declare new helper function. (svn_ra_serf__setup_svndiff_accept_encoding): Accept a session instead of the 'using_compression' boolean argument.
* subversion/libsvn_ra_serf/util.c (svn_ra_serf__is_local_network): Implement this new function. (svn_ra_serf__setup_svndiff_accept_encoding): Tweak the Accept-Encoding to indicate that we'd like to see svndiff2 with http-compression=auto and when working over a local network. Otherwise, when using compression, indicate both svndiff2 and svndiff1 support, but tell the server that we favor svndiff1. (setup_request): Properly handle the 'using_compression' field, which is now a tristate.
* subversion/libsvn_ra_serf/serf.c (load_config): Get the compression setting as a tristate. (svn_ra_serf__open): Initialize the connection latency to default value before we make the initial OPTIONS request. (ra_serf_dup_session): Add placeholder comment for the new field.
* subversion/libsvn_ra_serf/options.c (options_response_handler): Remember the connection latency in the session.
* subversion/libsvn_ra_serf/commit.c (negotiate_put_encoding): Rework to support new http-compression=auto mode. Update or rewrite the related comments.
* subversion/libsvn_ra_serf/blame.c (blame_context_t): Store session instead of the 'using_compression' field. (setup_headers): Update call to svn_ra_serf__setup_svndiff_accept_encoding(). (svn_ra_serf__get_file_revs): Remember the used session in context.
* subversion/libsvn_ra_serf/replay.c (revision_report_t): Store session instead of the 'using_compression' field. (setup_headers): Update call to svn_ra_serf__setup_svndiff_accept_encoding(). (svn_ra_serf__replay_range): Remember the used session in context.
* subversion/libsvn_ra_serf/update.c (fetch_ctx_t): Store session instead of the 'using_compression' field. (headers_fetch): Update call to svn_ra_serf__setup_svndiff_accept_encoding(). Properly handle the 'using_compression' field, which is now a tristate. (fetch_for_file): Remember the used session in the fetch context. (setup_update_report_headers): Update call to svn_ra_serf__setup_svndiff_accept_encoding().
* subversion/mod_dav_svn/repos.c (get_svndiff_version): New helper function. (negotiate_encoding_prefs): Tweak the negotiation logic. Only override the client's preference if it supports svndiff2 and SVNCompressionLevel is set to 1. In all other cases, select the svndiff format that the client prefers to see (the one with the largest ;q= value in the Accept- Encoding header).