[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Add config option to disable neon compression

From: solo turn <soloturn99_at_yahoo.com>
Date: 2002-11-20 14:41:31 CET

uhm ... i would be used to a compression level 0-9 or something like
this. is there a reason why subversion wants to be different here?

--- Justin Erenkrantz <jerenkrantz@apache.org> wrote:
> This patch allows the user to add:
>
> [miscellany]
> do_compression = no
>
> and Subversion will not send 'Accept-Encoding: gzip' to the server
> for any DAV requests.
>
> Works for me in both cases...
>
> Please yell at me (literally in the case of those here at the
> Hackathon) if you have any questions! -- justin> *
subversion/libsvn_ra_dav/fetch.c (custom_get_request),
> subversion/libsvn_ra_dav/util.c (svn_ra_dav__parsed_request):
> Look for [miscellany].do_compression in the config file, then
> conditionally disable neon's zlib compression if value isn't
> 'yes'
>
> Index: subversion/libsvn_ra_dav/fetch.c
> ===================================================================
> --- subversion/libsvn_ra_dav/fetch.c (revision 3814)
> +++ subversion/libsvn_ra_dav/fetch.c (working copy)
> @@ -44,6 +44,7 @@
> #include "svn_xml.h"
> #include "svn_dav.h"
> #include "svn_time.h"
> +#include "svn_config.h"
>
> #include "ra_dav.h"
>
> @@ -444,12 +445,25 @@
> {
> custom_get_ctx_t cgc = { 0 };
> const char *delta_base;
> + const char *do_compression;
> ne_request *req;
> ne_decompress *decompress;
> svn_error_t *err;
> + svn_config_t *cfg;
> int code;
> int decompress_rv;
> + int decompress_on;
>
> + SVN_ERR( svn_config_read_config(&cfg, pool) );
> +
> + svn_config_get(cfg, &do_compression, "miscellany",
> "do_compression", "yes");
> + if (strcasecmp(do_compression, "yes") == 0) {
> + decompress_on = 1;
> + }
> + else {
> + decompress_on = 0;
> + }
> +
> /* See if we can get a version URL for this resource. This will
> refer to
> what we already have in the working copy, thus we can get a
> diff against
> this particular resource. */
> @@ -482,7 +496,13 @@
> }
>
> /* add in a reader to capture the body of the response. */
> - decompress = ne_decompress_reader(req, ne_accept_2xx, reader,
> &cgc);
> + if (decompress_on) {
> + decompress = ne_decompress_reader(req, ne_accept_2xx, reader,
> &cgc);
> + }
> + else {
> + decompress = NULL;
> + ne_add_response_body_reader(req, ne_accept_2xx, reader, &cgc);
> + }
>
> /* complete initialization of the body reading context */
> cgc.subctx = subctx;
> @@ -493,7 +513,12 @@
> 226 /* IM Used */,
> pool);
>
> - decompress_rv = ne_decompress_destroy(decompress);
> + if (decompress) {
> + decompress_rv = ne_decompress_destroy(decompress);
> + }
> + else {
> + decompress_rv = 0;
> + }
>
> /* we no longer need this */
> if (cgc.ctype.value != NULL)
> Index: subversion/libsvn_ra_dav/util.c
> ===================================================================
> --- subversion/libsvn_ra_dav/util.c (revision 3814)
> +++ subversion/libsvn_ra_dav/util.c (working copy)
> @@ -25,6 +25,7 @@
> #include "svn_string.h"
> #include "svn_xml.h"
> #include "svn_path.h"
> +#include "svn_config.h"
>
> #include "ra_dav.h"
>
> @@ -216,10 +217,23 @@
> ne_xml_parser *error_parser;
> int rv;
> int decompress_rv;
> + int decompress_on;
> int code;
> const char *msg;
> + const char *do_compression;
> + svn_config_t *cfg;
> svn_error_t *err = SVN_NO_ERROR;
>
> + SVN_ERR( svn_config_read_config(&cfg, pool) );
> +
> + svn_config_get(cfg, &do_compression, "miscellany",
> "do_compression", "yes");
> + if (strcasecmp(do_compression, "yes") == 0) {
> + decompress_on = 1;
> + }
> + else {
> + decompress_on = 0;
> + }
> +
> /* create/prep the request */
> req = ne_request_create(ras->sess, method, url);
>
> @@ -243,27 +257,51 @@
>
> /* Register the "main" accepter and body-reader with the request
> --
> the one to use when the HTTP status is 2XX */
> - decompress_main = ne_decompress_reader(req, ne_accept_2xx,
> - ne_xml_parse_v,
> success_parser);
> + if (decompress_on)
> + {
> + decompress_main = ne_decompress_reader(req, ne_accept_2xx,
> + ne_xml_parse_v,
> success_parser);
> + }
> + else
> + {
> + decompress_main = NULL;
> + ne_add_response_body_reader(req, ne_accept_2xx,
> ne_xml_parse_v,
> + success_parser);
> + }
>
> /* Register the "error" accepter and body-reader with the
> request
> --
> the one to use when HTTP status is *not* 2XX */
> - decompress_err = ne_decompress_reader(req,
> ra_dav_error_accepter,
> - ne_xml_parse_v,
> error_parser);
> + if (decompress_on)
> + {
> + decompress_err = ne_decompress_reader(req,
> ra_dav_error_accepter,
> + ne_xml_parse_v,
> error_parser);
> + }
> + else
> + {
> + decompress_err = NULL;
> + ne_add_response_body_reader(req, ra_dav_error_accepter,
> ne_xml_parse_v,
> + error_parser);
> + }
>
> /* run the request and get the resulting status code. */
> rv = ne_request_dispatch(req);
>
> - decompress_rv = ne_decompress_destroy(decompress_main);
> - if (decompress_rv != 0)
> + if (decompress_main)
> {
> - rv = decompress_rv;
> + decompress_rv = ne_decompress_destroy(decompress_main);
> + if (decompress_rv != 0)
> + {
> + rv = decompress_rv;
> + }
> }
>
> - decompress_rv = ne_decompress_destroy(decompress_err);
> - if (decompress_rv != 0)
> + if (decompress_err)
> {
> - rv = decompress_rv;
> + decompress_rv = ne_decompress_destroy(decompress_err);
> + if (decompress_rv != 0)
> + {
> + rv = decompress_rv;
> + }
> }
>
> code = ne_get_status(req)->code;
>
> >
---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: dev-help@subversion.tigris.org

__________________________________________________
Do you Yahoo!?
Yahoo! Web Hosting - Let the expert host your site
http://webhosting.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Wed Nov 20 14:42:12 2002

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.