Commit 6ce2f1ee authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add -chunked primitive for easier message composition.

Go over varnishtest with FlexeLint



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2816 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 7441d21a
...@@ -7,38 +7,44 @@ ...@@ -7,38 +7,44 @@
// 796 and 797 (out-of-bounds errors). // 796 and 797 (out-of-bounds errors).
-elib(123) // size is both a variable and a macro with args -elib(123) // size is both a variable and a macro with args
-emacro(736, isnan) // isnanf -emacro(736, isnan) // isnanf
-efile(766, ../../config.h)
-sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 )) // -header(../../config.h)
-sem(vsb_new, @p == malloc(1)) // Fix strchr() semtics, it can only return NULL if arg2 != 0
-sem(vsb_delete, custodial(1)) -sem(strchr, 1p, type(1), 2n == 0 ? (@p < 1p) : (@p < 1p || @p == 0 ))
//
// -sem(vsb_new, @p == malloc(1))
// -sem(vsb_delete, custodial(1))
-sem(lbv_assert, r_no) -sem(lbv_assert, r_no)
-sem(lbv_xxxassert, r_no) -sem(lbv_xxxassert, r_no)
// -sem(WS_Init, custodial(2))
-ffc // No automatic custody // -sem(http_Setup, custodial(2))
//
// -ffc // No automatic custody
//
-e763 // Redundant declaration for symbol '...' previously declared -e763 // Redundant declaration for symbol '...' previously declared
-e726 // Extraneous comma ignored // -e726 // Extraneous comma ignored
-e728 // Symbol ... not explicitly initialized // -e728 // Symbol ... not explicitly initialized
-e716 // while(1) ... -e716 // while(1) ...
-e785 // Too few initializers for aggregate // -e785 // Too few initializers for aggregate
-e786 // String concatenation within initializer // -e786 // String concatenation within initializer
//
-emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types) // -emacro(740, VTAILQ_PREV) // Unusual pointer cast (incompatible indirect types)
-emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types) // -emacro(740, VTAILQ_LAST) // Unusual pointer cast (incompatible indirect types)
-emacro((826), VTAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small) // -emacro((826), VTAILQ_PREV) // Suspicious pointer-to-pointer conversion (area too small)
-emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small) // -emacro((826), VTAILQ_LAST) // Suspicious pointer-to-pointer conversion (area too small)
-emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean -emacro(506, VTAILQ_FOREACH_SAFE) // constant value boolean
//
-esym(534, sprintf) // Ignoring return value of function -esym(534, sprintf) // Ignoring return value of function
-esym(534, asprintf) // Ignoring return value of function // -esym(534, asprintf) // Ignoring return value of function
-esym(534, printf) // Ignoring return value of function -esym(534, printf) // Ignoring return value of function
-esym(534, fprintf) // Ignoring return value of function -esym(534, fprintf) // Ignoring return value of function
-esym(534, memset) // Ignoring return value of function -esym(534, memset) // Ignoring return value of function
-esym(534, memcpy) // Ignoring return value of function // -esym(534, memcpy) // Ignoring return value of function
-esym(534, memmove) // Ignoring return value of function // -esym(534, memmove) // Ignoring return value of function
-esym(534, strcpy) // Ignoring return value of function // -esym(534, strcpy) // Ignoring return value of function
-esym(534, vsb_printf) // Ignoring return value of function -esym(534, vsb_printf) // Ignoring return value of function
-esym(534, vsb_cat) // Ignoring return value of function -esym(534, vsb_cat) // Ignoring return value of function
-esym(534, vsb_bcat) // Ignoring return value of function -esym(534, vsb_bcat) // Ignoring return value of function
...@@ -46,33 +52,44 @@ ...@@ -46,33 +52,44 @@
-esym(534, strcat) // Ignoring return value of function -esym(534, strcat) // Ignoring return value of function
-esym(534, strcpy) // Ignoring return value of function -esym(534, strcpy) // Ignoring return value of function
-esym(534, strlcpy) // Ignoring return value of function -esym(534, strlcpy) // Ignoring return value of function
//
-emacro(506, isnan) // constant value boolean // -emacro(506, isnan) // constant value boolean
-emacro(747, isnan) // significant coersion // -emacro(747, isnan) // significant coersion
-emacro(506, assert) // constant value boolean // -emacro(506, assert) // constant value boolean
-emacro(827, assert) // loop not reachable // -emacro(827, assert) // loop not reachable
-emacro(774, assert) // booelan always true // -emacro(774, assert) // booelan always true
// -emacro(774, HTTPH) // always false
// cache.h //
-emacro(506, INCOMPL) // Constant value Boolean // // cache.h
// -emacro(506, INCOMPL) // Constant value Boolean
// Review all below this line /////////////////////////////////////////////// //
// // cache_center.c
// -efunc(525, CNT_Session) // Negative indentation from line
// -efunc(525, http_FilterFields) // Negative indentation from line
// -efunc(539, http_FilterFields) // Positive indentation from line
//
// // cache_vcl.c
// -efunc(525, vcl_handlingname) // Negative indentation from line
// -esym(528, vcl_handlingname) // Not referenced
// -e641 // Converting enum 'cli_status_e' to int
//
// // Review all below this line ///////////////////////////////////////////////
//
-e732 // Loss of sign (arg. no. 2) (int to unsigned -e732 // Loss of sign (arg. no. 2) (int to unsigned
-e737 // [45] Loss of sign in promotion from int to unsigned -e737 // [45] Loss of sign in promotion from int to unsigned
-e713 // Loss of precision (assignment) (unsigned long long to long long) -e713 // Loss of precision (assignment) (unsigned long long to long long)
-e574 // Signed-unsigned mix with relational -e574 // Signed-unsigned mix with relational
-e712 // Loss of precision (assignment) (long long to // -e712 // Loss of precision (assignment) (long long to
-e747 // Significant prototype coercion (arg. no. 2) long // -e747 // Significant prototype coercion (arg. no. 2) long
//
/* // /*
//
-e767 // Macro redef (system queue.h vs ours ) // -e767 // Macro redef (system queue.h vs ours )
//
-e506 // Constant value boolean // -e506 // Constant value boolean
-e818 // Pointer parameter '...' could be declared as pointing to const // -e818 // Pointer parameter '...' could be declared as pointing to const
-e774 // Boolean within 'if' always evaluates to False // -e774 // Boolean within 'if' always evaluates to False
-e534 // Ignoring return value of function // -e534 // Ignoring return value of function
-e557 // unrecog format // -e557 // unrecog format
//
*/ // */
...@@ -6,11 +6,10 @@ flexelint \ ...@@ -6,11 +6,10 @@ flexelint \
-I. \ -I. \
-I../../include \ -I../../include \
-I../.. \ -I../.. \
-DVARNISH_STATE_DIR=\"foo\" \
flint.lnt \ flint.lnt \
*.c > $T 2>&1 *.c > $T 2>&1
for t in Error Warning Info for t in Error Warning Info Note
do do
sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T
done | awk ' done | awk '
......
...@@ -19,8 +19,8 @@ server s1 { ...@@ -19,8 +19,8 @@ server s1 {
send "Transfer-encoding: chunked\r\n" send "Transfer-encoding: chunked\r\n"
send "\r\n" send "\r\n"
send "00000004\r\n1234\r\n" send "00000004\r\n1234\r\n"
send "00000004\r\n1234\r\n" chunked "1234"
send "00000000\r\n" chunked ""
} }
server s1 -start server s1 -start
......
...@@ -61,11 +61,11 @@ read_file(const char *fn) ...@@ -61,11 +61,11 @@ read_file(const char *fn)
err(1, "Cannot open %s", fn); err(1, "Cannot open %s", fn);
buf = malloc(sz); buf = malloc(sz);
assert(buf != NULL); assert(buf != NULL);
s = read(fd, buf, sz); s = read(fd, buf, sz - 1);
if (s <= 0) if (s <= 0)
err(1, "Cannot read %s", fn); err(1, "Cannot read %s", fn);
assert(s < sz); /* XXX: increase MAX_FILESIZE */
AZ(close (fd)); AZ(close (fd));
assert(s < sz); /* XXX: increase MAX_FILESIZE */
buf[s] = '\0'; buf[s] = '\0';
buf = realloc(buf, s + 1); buf = realloc(buf, s + 1);
assert(buf != NULL); assert(buf != NULL);
...@@ -141,7 +141,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) ...@@ -141,7 +141,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
p++; p++;
} else if (*p == '{') { /* Braces */ } else if (*p == '{') { /* Braces */
nest_brace = 0; nest_brace = 0;
token_s[tn] = p; token_s[tn] = p + 1;
for (; *p != '\0'; p++) { for (; *p != '\0'; p++) {
if (*p == '{') if (*p == '{')
nest_brace++; nest_brace++;
...@@ -151,7 +151,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) ...@@ -151,7 +151,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
} }
} }
assert(*p == '}'); assert(*p == '}');
token_e[tn++] = ++p; token_e[tn++] = p++;
} else { /* other tokens */ } else { /* other tokens */
token_s[tn] = p; token_s[tn] = p;
for (; *p != '\0' && !isspace(*p); p++) for (; *p != '\0' && !isspace(*p); p++)
...@@ -228,7 +228,7 @@ cmd_shell(CMD_ARGS) ...@@ -228,7 +228,7 @@ cmd_shell(CMD_ARGS)
AN(av[1]); AN(av[1]);
AZ(av[2]); AZ(av[2]);
vtc_dump(vl, 4, "shell", av[1]); vtc_dump(vl, 4, "shell", av[1]);
system(av[1]); (void)system(av[1]); /* XXX: assert ? */
} }
/********************************************************************** /**********************************************************************
...@@ -303,7 +303,7 @@ exec_file(const char *fn) ...@@ -303,7 +303,7 @@ exec_file(const char *fn)
*/ */
int int
main(int argc, char **argv) main(int argc, char * const *argv)
{ {
int ch; int ch;
......
...@@ -30,7 +30,7 @@ struct vsb; ...@@ -30,7 +30,7 @@ struct vsb;
struct vtclog; struct vtclog;
struct cmds; struct cmds;
#define CMD_ARGS char **av, void *priv, const struct cmds *cmd #define CMD_ARGS char * const *av, void *priv, const struct cmds *cmd
typedef void cmd_f(CMD_ARGS); typedef void cmd_f(CMD_ARGS);
struct cmds { struct cmds {
......
...@@ -208,11 +208,10 @@ cmd_client(CMD_ARGS) ...@@ -208,11 +208,10 @@ cmd_client(CMD_ARGS)
client_run(c); client_run(c);
continue; continue;
} }
if (**av == '{') { if (**av == '-') {
c->spec = *av; vtc_log(c->vl, 0, "Unknown client argument: %s", *av);
continue; exit (1);
} }
vtc_log(c->vl, 0, "Unknown client argument: %s", *av); c->spec = *av;
exit (1);
} }
} }
...@@ -51,6 +51,8 @@ struct http { ...@@ -51,6 +51,8 @@ struct http {
int timeout; int timeout;
struct vtclog *vl; struct vtclog *vl;
struct vsb *vsb;
int nrxbuf; int nrxbuf;
char *rxbuf; char *rxbuf;
...@@ -58,12 +60,31 @@ struct http { ...@@ -58,12 +60,31 @@ struct http {
char *resp[MAX_HDR]; char *resp[MAX_HDR];
}; };
/* XXX: we may want to vary this */
static const char *nl = "\r\n";
/**********************************************************************
* Finish and write the vsb to the fd
*/
static void
http_write(const struct http *hp, int lvl, const char *pfx)
{
int l;
vsb_finish(hp->vsb);
AZ(vsb_overflowed(hp->vsb));
vtc_dump(hp->vl, lvl, pfx, vsb_data(hp->vsb));
l = write(hp->fd, vsb_data(hp->vsb), vsb_len(hp->vsb));
assert(l == vsb_len(hp->vsb));
}
/********************************************************************** /**********************************************************************
* find header * find header
*/ */
static char * static char *
http_find_header(char **hh, const char *hdr) http_find_header(char * const *hh, const char *hdr)
{ {
int n, l; int n, l;
char *r; char *r;
...@@ -235,7 +256,7 @@ http_splitheader(struct http *hp, int req) ...@@ -235,7 +256,7 @@ http_splitheader(struct http *hp, int req)
*/ */
static void static void
http_swallow_body(struct http *hp, char **hh) http_swallow_body(const struct http *hp, char * const *hh)
{ {
char *p, b[BUFSIZ + 1]; char *p, b[BUFSIZ + 1];
int l, i; int l, i;
...@@ -334,14 +355,11 @@ static void ...@@ -334,14 +355,11 @@ static void
cmd_http_txresp(CMD_ARGS) cmd_http_txresp(CMD_ARGS)
{ {
struct http *hp; struct http *hp;
struct vsb *vsb;
const char *proto = "HTTP/1.1"; const char *proto = "HTTP/1.1";
const char *status = "200"; const char *status = "200";
const char *msg = "Ok"; const char *msg = "Ok";
const char *body = NULL; const char *body = NULL;
int dohdr = 0; int dohdr = 0;
const char *nl = "\r\n";
int l;
(void)cmd; (void)cmd;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
...@@ -349,7 +367,7 @@ cmd_http_txresp(CMD_ARGS) ...@@ -349,7 +367,7 @@ cmd_http_txresp(CMD_ARGS)
assert(!strcmp(av[0], "txresp")); assert(!strcmp(av[0], "txresp"));
av++; av++;
vsb = vsb_newauto(); vsb_clear(hp->vsb);
for(; *av != NULL; av++) { for(; *av != NULL; av++) {
if (!strcmp(*av, "-proto")) { if (!strcmp(*av, "-proto")) {
...@@ -377,11 +395,11 @@ cmd_http_txresp(CMD_ARGS) ...@@ -377,11 +395,11 @@ cmd_http_txresp(CMD_ARGS)
} }
if (!strcmp(*av, "-hdr")) { if (!strcmp(*av, "-hdr")) {
if (dohdr == 0) { if (dohdr == 0) {
vsb_printf(vsb, "%s %s %s%s", vsb_printf(hp->vsb, "%s %s %s%s",
proto, status, msg, nl); proto, status, msg, nl);
dohdr = 1; dohdr = 1;
} }
vsb_printf(vsb, "%s%s", av[1], nl); vsb_printf(hp->vsb, "%s%s", av[1], nl);
av++; av++;
continue; continue;
} }
...@@ -389,21 +407,16 @@ cmd_http_txresp(CMD_ARGS) ...@@ -389,21 +407,16 @@ cmd_http_txresp(CMD_ARGS)
exit (1); exit (1);
} }
if (dohdr == 0) { if (dohdr == 0) {
vsb_printf(vsb, "%s %s %s%s", vsb_printf(hp->vsb, "%s %s %s%s",
proto, status, msg, nl); proto, status, msg, nl);
dohdr = 1; dohdr = 1;
} }
vsb_cat(vsb, nl); vsb_cat(hp->vsb, nl);
if (body != NULL) { if (body != NULL) {
vsb_cat(vsb, body); vsb_cat(hp->vsb, body);
vsb_cat(vsb, nl); vsb_cat(hp->vsb, nl);
} }
vsb_finish(vsb); http_write(hp, 4, "txresp");
AZ(vsb_overflowed(vsb));
vtc_dump(hp->vl, 4, NULL, vsb_data(vsb));
l = write(hp->fd, vsb_data(vsb), vsb_len(vsb));
assert(l == vsb_len(vsb));
vsb_delete(vsb);
} }
/********************************************************************** /**********************************************************************
...@@ -439,14 +452,11 @@ static void ...@@ -439,14 +452,11 @@ static void
cmd_http_txreq(CMD_ARGS) cmd_http_txreq(CMD_ARGS)
{ {
struct http *hp; struct http *hp;
struct vsb *vsb;
const char *req = "GET"; const char *req = "GET";
const char *url = "/"; const char *url = "/";
const char *proto = "HTTP/1.1"; const char *proto = "HTTP/1.1";
const char *body = NULL; const char *body = NULL;
int dohdr = 0; int dohdr = 0;
const char *nl = "\r\n";
int l;
(void)cmd; (void)cmd;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
...@@ -454,7 +464,7 @@ cmd_http_txreq(CMD_ARGS) ...@@ -454,7 +464,7 @@ cmd_http_txreq(CMD_ARGS)
assert(!strcmp(av[0], "txreq")); assert(!strcmp(av[0], "txreq"));
av++; av++;
vsb = vsb_newauto(); vsb_clear(hp->vsb);
for(; *av != NULL; av++) { for(; *av != NULL; av++) {
if (!strcmp(*av, "-url")) { if (!strcmp(*av, "-url")) {
...@@ -477,11 +487,11 @@ cmd_http_txreq(CMD_ARGS) ...@@ -477,11 +487,11 @@ cmd_http_txreq(CMD_ARGS)
} }
if (!strcmp(*av, "-hdr")) { if (!strcmp(*av, "-hdr")) {
if (dohdr == 0) { if (dohdr == 0) {
vsb_printf(vsb, "%s %s %s%s", vsb_printf(hp->vsb, "%s %s %s%s",
req, url, proto, nl); req, url, proto, nl);
dohdr = 1; dohdr = 1;
} }
vsb_printf(vsb, "%s%s", av[1], nl); vsb_printf(hp->vsb, "%s%s", av[1], nl);
av++; av++;
continue; continue;
} }
...@@ -494,21 +504,16 @@ cmd_http_txreq(CMD_ARGS) ...@@ -494,21 +504,16 @@ cmd_http_txreq(CMD_ARGS)
exit (1); exit (1);
} }
if (dohdr == 0) { if (dohdr == 0) {
vsb_printf(vsb, "%s %s %s%s", vsb_printf(hp->vsb, "%s %s %s%s",
req, url, proto, nl); req, url, proto, nl);
dohdr = 1; dohdr = 1;
} }
vsb_cat(vsb, nl); vsb_cat(hp->vsb, nl);
if (body != NULL) { if (body != NULL) {
vsb_cat(vsb, body); vsb_cat(hp->vsb, body);
vsb_cat(vsb, nl); vsb_cat(hp->vsb, nl);
} }
vsb_finish(vsb); http_write(hp, 4, "txreq");
AZ(vsb_overflowed(vsb));
vtc_dump(hp->vl, 4, NULL, vsb_data(vsb));
l = write(hp->fd, vsb_data(vsb), vsb_len(vsb));
assert(l == vsb_len(vsb));
vsb_delete(vsb);
} }
/********************************************************************** /**********************************************************************
...@@ -531,6 +536,24 @@ cmd_http_send(CMD_ARGS) ...@@ -531,6 +536,24 @@ cmd_http_send(CMD_ARGS)
} }
/**********************************************************************
* Send a string as chunked encoding
*/
static void
cmd_http_chunked(CMD_ARGS)
{
struct http *hp;
(void)cmd;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AN(av[1]);
AZ(av[2]);
vsb_clear(hp->vsb);
vsb_printf(hp->vsb, "%x%s%s%s", strlen(av[1]), nl, av[1], nl);
http_write(hp, 4, "chunked");
}
/********************************************************************** /**********************************************************************
* Execute HTTP specifications * Execute HTTP specifications
...@@ -543,6 +566,7 @@ static struct cmds http_cmds[] = { ...@@ -543,6 +566,7 @@ static struct cmds http_cmds[] = {
{ "rxresp", cmd_http_rxresp }, { "rxresp", cmd_http_rxresp },
{ "expect", cmd_http_expect }, { "expect", cmd_http_expect },
{ "send", cmd_http_send }, { "send", cmd_http_send },
{ "chunked", cmd_http_chunked },
{ "delay", cmd_delay }, { "delay", cmd_delay },
{ NULL, NULL } { NULL, NULL }
}; };
...@@ -560,14 +584,14 @@ http_process(struct vtclog *vl, const char *spec, int sock, int client) ...@@ -560,14 +584,14 @@ http_process(struct vtclog *vl, const char *spec, int sock, int client)
hp->client = client; hp->client = client;
hp->timeout = 1000; hp->timeout = 1000;
hp->nrxbuf = 8192; hp->nrxbuf = 8192;
hp->vsb = vsb_newauto();
AN(hp->vsb);
s = strdup(spec + 1); s = strdup(spec);
q = strchr(s, '\0'); q = strchr(s, '\0');
assert(q > s); assert(q > s);
q--;
assert(*q == '}');
*q = '\0';
AN(s); AN(s);
parse_string(s, http_cmds, hp); parse_string(s, http_cmds, hp);
vsb_delete(hp->vsb);
free(hp); free(hp);
} }
...@@ -73,6 +73,7 @@ static const char *lead[] = { ...@@ -73,6 +73,7 @@ static const char *lead[] = {
#define NLEAD (sizeof(lead)/sizeof(lead[0])) #define NLEAD (sizeof(lead)/sizeof(lead[0]))
//lint -e{818}
void void
vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
{ {
...@@ -98,6 +99,7 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...) ...@@ -98,6 +99,7 @@ vtc_log(struct vtclog *vl, unsigned lvl, const char *fmt, ...)
* Dump a string * Dump a string
*/ */
//lint -e{818}
void void
vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str) vtc_dump(struct vtclog *vl, unsigned lvl, const char *pfx, const char *str)
{ {
......
...@@ -252,11 +252,10 @@ cmd_server(CMD_ARGS) ...@@ -252,11 +252,10 @@ cmd_server(CMD_ARGS)
server_wait(s); server_wait(s);
continue; continue;
} }
if (**av == '{') { if (**av == '-') {
s->spec = *av; vtc_log(s->vl, 0, "Unknown server argument: %s", *av);
continue; exit (1);
} }
vtc_log(s->vl, 0, "Unknown server argument: %s", *av); s->spec = *av;
exit (1);
} }
} }
...@@ -29,19 +29,17 @@ ...@@ -29,19 +29,17 @@
#include <stdio.h> #include <stdio.h>
#include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <pthread.h>
#include <signal.h> #include <signal.h>
#include <pthread.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <sys/socket.h> #include <sys/socket.h>
#include "vqueue.h" #include "vqueue.h"
#include "miniobj.h" #include "miniobj.h"
#include "libvarnish.h" #include "libvarnish.h"
...@@ -91,7 +89,7 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl) ...@@ -91,7 +89,7 @@ varnish_ask_cli(const struct varnish *v, const char *cmd, char **repl)
assert(i == strlen(cmd)); assert(i == strlen(cmd));
i = write(v->cli_fd, "\n", 1); i = write(v->cli_fd, "\n", 1);
assert(i == 1); assert(i == 1);
i = cli_readres(v->cli_fd, &retval, &r, 1000); i = cli_readres(v->cli_fd, &retval, &r, 1.0);
assert(i == 0); assert(i == 0);
vtc_dump(v->vl, 4, "CLI RX", r); vtc_dump(v->vl, 4, "CLI RX", r);
vtc_log(v->vl, 3, "CLI STATUS %u", retval); vtc_log(v->vl, 3, "CLI STATUS %u", retval);
...@@ -358,10 +356,9 @@ varnish_vcl(struct varnish *v, const char *vcl) ...@@ -358,10 +356,9 @@ varnish_vcl(struct varnish *v, const char *vcl)
*/ */
static void static void
varnish_vclbackend(struct varnish *v, char *vcl) varnish_vclbackend(struct varnish *v, const char *vcl)
{ {
struct vsb *vsb, *vsb2; struct vsb *vsb, *vsb2;
char *p;
enum cli_status_e u; enum cli_status_e u;
if (v->cli_fd < 0) if (v->cli_fd < 0)
...@@ -381,11 +378,6 @@ varnish_vclbackend(struct varnish *v, char *vcl) ...@@ -381,11 +378,6 @@ varnish_vclbackend(struct varnish *v, char *vcl)
varnish_cli_encode(vsb, vsb_data(vsb2)); varnish_cli_encode(vsb, vsb_data(vsb2));
if (*vcl == '{') {
p = strchr(++vcl, '\0');
if (p > vcl && p[-1] == '}')
p[-1] = '\0';
}
varnish_cli_encode(vsb, vcl); varnish_cli_encode(vsb, vcl);
vsb_printf(vsb, "\"", *vcl); vsb_printf(vsb, "\"", *vcl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment