summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-19 17:32:56 +0000
committerJean-Francois Brousseau <jfb@cvs.openbsd.org>2004-12-19 17:32:56 +0000
commit2f0932497de9a9782520a5da44592a0680321718 (patch)
treefe77b09200fecd712c052dce6b1350c367d97269
parented1cd886c2d5ea9e4ae996a53a92f0c7ad6c8acb (diff)
add a handler for the Gzip-stream request. The handler parses the
requested compression level but does not enable compression yet.
-rw-r--r--usr.bin/cvs/req.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/usr.bin/cvs/req.c b/usr.bin/cvs/req.c
index e70ce19dd42..8f0e0026181 100644
--- a/usr.bin/cvs/req.c
+++ b/usr.bin/cvs/req.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: req.c,v 1.7 2004/12/07 17:10:56 tedu Exp $ */
+/* $OpenBSD: req.c,v 1.8 2004/12/19 17:32:55 jfb Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -62,6 +62,7 @@ static int cvs_req_directory (int, char *);
static int cvs_req_case (int, char *);
static int cvs_req_argument (int, char *);
static int cvs_req_globalopt (int, char *);
+static int cvs_req_gzipstream (int, char *);
static int cvs_req_version (int, char *);
@@ -91,7 +92,7 @@ struct cvs_reqhdlr {
{ cvs_req_argument }, /* 20 */
{ cvs_req_argument },
{ cvs_req_globalopt },
- { NULL },
+ { cvs_req_gzipstream },
{ NULL },
{ NULL },
{ NULL },
@@ -320,6 +321,35 @@ cvs_req_globalopt(int reqid, char *line)
}
+/*
+ * cvs_req_gzipstream()
+ *
+ * Handler for the `Gzip-stream' request, which enables compression at the
+ * level given along with the request. After this request has been processed,
+ * all further connection data should be compressed.
+ */
+
+static int
+cvs_req_gzipstream(int reqid, char *line)
+{
+ char *ep;
+ long val;
+
+ val = strtol(line, &ep, 10);
+ if ((line[0] == '\0') || (*ep != '\0')) {
+ cvs_log(LP_ERR, "invalid Gzip-stream level `%s'", line);
+ return (-1);
+ } else if ((errno == ERANGE) && ((val < 0) || (val > 9))) {
+ cvs_log(LP_ERR, "Gzip-stream level %ld out of range", val);
+ return (-1);
+ }
+
+ cvs_compress = (int)val;
+
+ return (0);
+}
+
+
static int
cvs_req_version(int reqid, char *line)
{