Commit d18336e5 authored by Andreas Plesner Jacobsen's avatar Andreas Plesner Jacobsen Committed by Tollef Fog Heen

Add default values for some fields when logging imcomplete records.

Allow %r format to log incomplete records too.
Update docs to reflect new defaults

Fixes #1028
parent e422c767
......@@ -600,7 +600,7 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
break;
case 'H':
VSB_cat(os, lp->df_H);
VSB_cat(os, lp->df_H ? lp->df_H : "HTTP/1.0");
break;
case 'h':
......@@ -614,7 +614,7 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
break;
case 'm':
VSB_cat(os, lp->df_m);
VSB_cat(os, lp->df_m ? lp->df_m : "-");
break;
case 'q':
......@@ -626,24 +626,19 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
* Fake "%r". This would be a lot easier if Varnish
* normalized the request URL.
*/
if (!lp->df_m ||
!req_header(lp, "Host") ||
!lp->df_U ||
!lp->df_H) {
clean_logline(lp);
return (reopen);
}
VSB_cat(os, lp->df_m);
VSB_cat(os, lp->df_m ? lp->df_m : "-");
VSB_putc(os, ' ');
if (req_header(lp, "Host")) {
if (strncmp(req_header(lp, "Host"), "http://", 7) != 0)
VSB_cat(os, "http://");
VSB_cat(os, req_header(lp, "Host"));
} else {
VSB_cat(os, "http://localhost");
}
VSB_cat(os, lp->df_U);
VSB_cat(os, lp->df_U ? lp->df_U : "-");
VSB_cat(os, lp->df_q ? lp->df_q : "");
VSB_putc(os, ' ');
VSB_cat(os, lp->df_H);
VSB_cat(os, lp->df_H ? lp->df_H : "HTTP/1.0");
break;
case 's':
......@@ -658,7 +653,7 @@ h_ncsa(void *priv, enum VSL_tag_e tag, unsigned fd,
break;
case 'U':
VSB_cat(os, lp->df_U);
VSB_cat(os, lp->df_U ? lp->df_U : "-");
break;
case 'u':
......
......@@ -62,10 +62,12 @@ The following options are available:
bytes are sent.
%H
The request protocol
The request protocol. Defaults to HTTP/1.0 if not
known.
%h
Remote host
Remote host. Defaults to '-' if not known.
Defaults to 127.0.0.1 for backend requests.
%{X}i
The contents of request header line X.
......@@ -74,16 +76,18 @@ The following options are available:
Remote logname (always '-')
%m
Request method
Request method. Defaults to '-' if not known.
%q
The query string, if no query string exists, an empty string.
The query string, if no query string exists, an
empty string.
%{X}o
The contents of response header line X.
%r
The first line of the request
The first line of the request. Synthesized from other
fields, so it may not be the request verbatim.
%s
Status sent to the client
......@@ -93,7 +97,8 @@ The following options are available:
format.
%U
The request URL without any query string.
The request URL without any query string. Defaults to
'-' if not known.
%u
Remote user from auth
......
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