Commit 833e2a62 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Don't append a CRNL to the body.

And add separate rxhdrs and rxbody primitives.

Submitted by: Yonatan Broza & Dmitry Rubinstein



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3540 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 398fd3e6
...@@ -531,10 +531,8 @@ cmd_http_txresp(CMD_ARGS) ...@@ -531,10 +531,8 @@ cmd_http_txresp(CMD_ARGS)
if (body != NULL) if (body != NULL)
vsb_printf(hp->vsb, "Content-Length: %d%s", strlen(body), nl); vsb_printf(hp->vsb, "Content-Length: %d%s", strlen(body), nl);
vsb_cat(hp->vsb, nl); vsb_cat(hp->vsb, nl);
if (body != NULL) { if (body != NULL)
vsb_cat(hp->vsb, body); vsb_cat(hp->vsb, body);
vsb_cat(hp->vsb, nl);
}
http_write(hp, 4, "txresp"); http_write(hp, 4, "txresp");
} }
...@@ -565,6 +563,48 @@ cmd_http_rxreq(CMD_ARGS) ...@@ -565,6 +563,48 @@ cmd_http_rxreq(CMD_ARGS)
vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen); vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen);
} }
static void
cmd_http_rxhdrs(CMD_ARGS)
{
struct http *hp;
(void)cmd;
(void)vl;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AZ(hp->client);
assert(!strcmp(av[0], "rxhdrs"));
av++;
for(; *av != NULL; av++) {
fprintf(stderr, "Unknown http rxreq spec: %s\n", *av);
exit (1);
}
vtc_log(hp->vl, 3, "rxhdrs");
http_rxhdr(hp);
http_splitheader(hp, 1);
}
static void
cmd_http_rxbody(CMD_ARGS)
{
struct http *hp;
(void)cmd;
(void)vl;
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AZ(hp->client);
assert(!strcmp(av[0], "rxbody"));
av++;
for(; *av != NULL; av++) {
fprintf(stderr, "Unknown http rxreq spec: %s\n", *av);
exit (1);
}
vtc_log(hp->vl, 3, "rxbody");
http_swallow_body(hp, hp->req, 0);
vtc_log(hp->vl, 4, "bodylen = %s", hp->bodylen);
}
/********************************************************************** /**********************************************************************
* Transmit a request * Transmit a request
*/ */
...@@ -698,7 +738,11 @@ cmd_http_timeout(CMD_ARGS) ...@@ -698,7 +738,11 @@ cmd_http_timeout(CMD_ARGS)
static struct cmds http_cmds[] = { static struct cmds http_cmds[] = {
{ "timeout", cmd_http_timeout }, { "timeout", cmd_http_timeout },
{ "txreq", cmd_http_txreq }, { "txreq", cmd_http_txreq },
{ "rxreq", cmd_http_rxreq }, { "rxreq", cmd_http_rxreq },
{ "rxhdrs", cmd_http_rxhdrs },
{ "rxbody", cmd_http_rxbody },
{ "txresp", cmd_http_txresp }, { "txresp", cmd_http_txresp },
{ "rxresp", cmd_http_rxresp }, { "rxresp", cmd_http_rxresp },
{ "expect", cmd_http_expect }, { "expect", cmd_http_expect },
......
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