Commit c8a05bf6 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Tollef Fog Heen

Add text representation to Fetch_Body VSL message.

parent 0a7a30da
/*-
* Copyright (c) 2011 Varnish Software AS
* All rights reserved.
*
* Author: Poul-Henning Kamp <phk@phk.freebsd.dk>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* Various ways to handle the body coming from the backend.
*/
/*lint -save -e525 -e539 */
BODYSTATUS(NONE, none)
BODYSTATUS(ZERO, zero)
BODYSTATUS(ERROR, error)
BODYSTATUS(CHUNKED, chunked)
BODYSTATUS(LENGTH, length)
BODYSTATUS(EOF, eof)
/*lint -restore */
......@@ -66,14 +66,23 @@
#include "vsl.h"
enum body_status {
BS_NONE,
BS_ZERO,
BS_ERROR,
BS_CHUNKED,
BS_LENGTH,
BS_EOF
#define BODYSTATUS(U,l) BS_##U,
#include "body_status.h"
#undef BODYSTATUS
};
static inline const char *
body_status(enum body_status e)
{
switch(e) {
#define BODYSTATUS(U,l) case BS_##U: return (#l);
#include "body_status.h"
#undef BODYSTATUS
default:
return ("?");
}
}
/*
* NB: HDR_STATUS is only used in cache_http.c, everybody else uses the
* http->status integer field.
......
......@@ -543,8 +543,9 @@ FetchBody(struct sess *sp)
*/
AZ(vfp_nop_end(sp));
WSL(sp->wrk, SLT_Fetch_Body, sp->vbc->fd, "%u %d %u",
sp->wrk->body_status, cls, mklen);
WSL(sp->wrk, SLT_Fetch_Body, sp->vbc->fd, "%u(%s) %d %u",
sp->wrk->body_status, body_status(sp->wrk->body_status),
cls, mklen);
if (sp->wrk->body_status == BS_ERROR) {
VDI_CloseFd(sp);
......
......@@ -86,6 +86,7 @@
-efile(451, "sys/\*.h") // No include guard
-efile(451, "machine/\*.h") // No include guard
-efile(451, "vcl_returns.h") // No include guard
-efile(451, "body_status.h") // No include guard
-efile(451, "locks.h") // No include guard
-efile(451, "cache_backend_poll.h") // No include guard
-efile(451, "steps.h") // No include guard
......
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