/[gentoo-x86]/www-servers/varnish/files/varnish-2.0.4-virtual-ncsa.patch
Gentoo

Contents of /www-servers/varnish/files/varnish-2.0.4-virtual-ncsa.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Thu Jun 11 09:50:42 2009 UTC (5 years, 1 month ago) by hollow
Branch: MAIN
support virtual host log format in varnishncsa (upstream #485)
(Portage version: 2.2_rc33/cvs/Linux i686)

1 diff -NurpP varnish-2.0.4.orig/bin/varnishncsa/varnishncsa.c varnish-2.0.4/bin/varnishncsa/varnishncsa.c
2 --- varnish-2.0.4.orig/bin/varnishncsa/varnishncsa.c 2009-04-01 15:35:14.000000000 +0200
3 +++ varnish-2.0.4/bin/varnishncsa/varnishncsa.c 2009-06-11 11:45:44.084537099 +0200
4 @@ -102,6 +102,7 @@ static struct logline {
5
6 static size_t nll;
7 static int prefer_x_forwarded_for = 0;
8 +static int virtual_host_style_logging = 0;
9
10 static int
11 isprefix(const char *str, const char *prefix, const char *end,
12 @@ -399,6 +400,11 @@ h_ncsa(void *priv, enum shmlogtag tag, u
13 if (!lp->bogus) {
14 fo = priv;
15
16 + /* the -v option */
17 + if (virtual_host_style_logging) {
18 + fprintf(fo, "%s ", lp->df_Host);
19 + }
20 +
21 /* %h */
22 if (!lp->df_h && spec & VSL_S_BACKEND)
23 fprintf(fo, "127.0.0.1 ");
24 @@ -438,7 +444,7 @@ h_ncsa(void *priv, enum shmlogtag tag, u
25 * normalized the request URL.
26 */
27 fprintf(fo, "\"%s ", lp->df_m);
28 - if (lp->df_Host) {
29 + if (!virtual_host_style_logging && lp->df_Host) {
30 if (strncmp(lp->df_Host, "http://", 7) != 0)
31 fprintf(fo, "http://");
32 fprintf(fo, "%s", lp->df_Host);
33 @@ -512,7 +518,7 @@ usage(void)
34 {
35
36 fprintf(stderr,
37 - "usage: varnishncsa %s [-aDV] [-n varnish_name] "
38 + "usage: varnishncsa %s [-avDV] [-n varnish_name] "
39 "[-P file] [-w file]\n", VSL_USAGE);
40 exit(1);
41 }
42 @@ -531,11 +537,14 @@ main(int argc, char *argv[])
43
44 vd = VSL_New();
45
46 - while ((c = getopt(argc, argv, VSL_ARGS "aDn:P:Vw:f")) != -1) {
47 + while ((c = getopt(argc, argv, VSL_ARGS "avDn:P:Vw:f")) != -1) {
48 switch (c) {
49 case 'a':
50 a_flag = 1;
51 break;
52 + case 'v':
53 + virtual_host_style_logging = 1;
54 + break;
55 case 'f':
56 prefer_x_forwarded_for = 1;
57 break;

  ViewVC Help
Powered by ViewVC 1.1.20