r97107 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97106‎ | r97107 | r97108 >
Date:22:27, 14 September 2011
Author:asher
Status:deferred
Tags:
Comment:
varnish3-wmf6 - add server hostname to udplog stream
Modified paths:
  • /trunk/debs/varnish3/debian/changelog (modified) (history)
  • /trunk/debs/varnish3/debian/patches/01-varnishncsa-udp.dpatch (modified) (history)
  • /trunk/debs/varnish3/debian/patches/debian-changes-3.0.0-1wmf1 (deleted) (history)
  • /trunk/debs/varnish3/debian/patches/debian-changes-3.0.0-1wmf6 (added) (history)
  • /trunk/debs/varnish3/debian/patches/series (modified) (history)

Diff [purge]

Index: trunk/debs/varnish3/debian/changelog
@@ -1,3 +1,9 @@
 2+varnish3 (3.0.0-1wmf6) lucid; urgency=low
 3+
 4+ * make %l log servername instead of always being "-"
 5+
 6+ -- Asher Feldman <afledman@wikimedia.org> Wed, 14 Sep 2011 14:22:22 +7000
 7+
28 varnish3 (3.0.0-1wmf5) lucid; urgency=low
39
410 * fix udp/mcast logging
Index: trunk/debs/varnish3/debian/patches/debian-changes-3.0.0-1wmf1
@@ -1,1643 +0,0 @@
2 -+++ varnish3-3.0.0/bin/varnishncsa/varnishncsa.c
3 -@@ -79,6 +79,13 @@
4 - #include "varnishapi.h"
5 - #include "base64.h"
6 -
7 -+#include <sys/types.h>
8 -+#include <sys/socket.h>
9 -+#include <netinet/in.h>
10 -+#include <netdb.h>
11 -+
12 -+static long int sequence_number = 0;
13 -+
14 - static volatile sig_atomic_t reopen;
15 -
16 - static struct logline {
17 -@@ -533,6 +540,8 @@ h_ncsa(void *priv, enum VSL_tag_e tag, u
18 - /* We have a complete data set - log a line */
19 -
20 - fo = priv;
21 -+
22 -+ sequence_number++;
23 -
24 - for (p = format; *p != '\0'; p++) {
25 -
26 -@@ -566,6 +575,10 @@ h_ncsa(void *priv, enum VSL_tag_e tag, u
27 - case 'm':
28 - fprintf(fo, "%s", lp->df_m);
29 - break;
30 -+
31 -+ case 'n':
32 -+ fprintf(fo, " %ld ", sequence_number);
33 -+ break;
34 -
35 - case 'q':
36 - fprintf(fo, "%s", lp->df_q ? lp->df_q : "");
37 -@@ -695,12 +708,54 @@ static FILE *
38 - open_log(const char *ofn, int append)
39 - {
40 - FILE *of;
41 -+ int sockfd, portno, n;
42 -+ struct sockaddr_in serv_addr;
43 -+ struct hostent *server;
44 -+ u_char ttl = 1;
45 -+ char host[500];
46 -+ char port[10];
47 -+
48 -+ sscanf(ofn, "%[^:]:%s", host, port);
49 -+
50 -+ portno = atoi(port);
51 -+ sockfd = socket(AF_INET, SOCK_DGRAM, 0);
52 -+
53 -+ if (sockfd < 0) {
54 -+ fprintf(stderr, "ERROR opening socket\n");
55 -+ }
56 -
57 -- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) {
58 -- perror(ofn);
59 -+ server = gethostbyname(host);
60 -+
61 -+ if (server == NULL) {
62 -+ fprintf(stderr,"ERROR, no such host\n");
63 - exit(1);
64 -+ }
65 -+
66 -+ bzero((char *) &serv_addr, sizeof(serv_addr));
67 -+
68 -+ if ((ntohl(serv_addr.sin_addr.s_addr) >> 28) == 0xe) {
69 -+ serv_addr.sin_addr.s_addr = INADDR_ANY;
70 -+ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_IF, &serv_addr,
71 -+ sizeof(struct sockaddr_in));
72 -+ setsockopt(sockfd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl,
73 -+ sizeof(unsigned char));
74 - }
75 -- return (of);
76 -+
77 -+ serv_addr.sin_family = AF_INET;
78 -+ serv_addr.sin_port = htons(portno);
79 -+
80 -+ if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) {
81 -+ perror("socket");
82 -+ exit(1);
83 -+ }
84 -+
85 -+ FILE *sf = fdopen(sockfd, "w");
86 -+
87 -+ if (sf == NULL) {
88 -+ exit(1);
89 -+ }
90 -+
91 -+ return (sf);
92 - }
93 -
94 - /*--------------------------------------------------------------------*/
95 -@@ -711,7 +766,7 @@ usage(void)
96 -
97 - fprintf(stderr,
98 - "usage: varnishncsa %s [-aDV] [-n varnish_name] "
99 -- "[-P file] [-w file]\n", VSL_USAGE);
100 -+ "[-P file] [-w host:port]\n", VSL_USAGE);
101 - exit(1);
102 - }
103 -
104 -@@ -724,7 +779,7 @@ main(int argc, char *argv[])
105 - const char *w_arg = NULL;
106 - struct vpf_fh *pfh = NULL;
107 - FILE *of;
108 -- format = "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
109 -+ format = "%h %n %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
110 -
111 - vd = VSM_New();
112 - VSL_Setup(vd);
113 -+++ varnish3-3.0.0/debian-test/varnish3-doc.docs
114 -@@ -0,0 +1 @@
115 -+#DOCS#
116 -+++ varnish3-3.0.0/debian-test/emacsen-install.ex
117 -@@ -0,0 +1,45 @@
118 -+#! /bin/sh -e
119 -+# /usr/lib/emacsen-common/packages/install/varnish3
120 -+
121 -+# Written by Jim Van Zandt <jrv@debian.org>, borrowing heavily
122 -+# from the install scripts for gettext by Santiago Vila
123 -+# <sanvila@ctv.es> and octave by Dirk Eddelbuettel <edd@debian.org>.
124 -+
125 -+FLAVOR=$1
126 -+PACKAGE=varnish3
127 -+
128 -+if [ ${FLAVOR} = emacs ]; then exit 0; fi
129 -+
130 -+echo install/${PACKAGE}: Handling install for emacsen flavor ${FLAVOR}
131 -+
132 -+#FLAVORTEST=`echo $FLAVOR | cut -c-6`
133 -+#if [ ${FLAVORTEST} = xemacs ] ; then
134 -+# SITEFLAG="-no-site-file"
135 -+#else
136 -+# SITEFLAG="--no-site-file"
137 -+#fi
138 -+FLAGS="${SITEFLAG} -q -batch -l path.el -f batch-byte-compile"
139 -+
140 -+ELDIR=/usr/share/emacs/site-lisp/${PACKAGE}
141 -+ELCDIR=/usr/share/${FLAVOR}/site-lisp/${PACKAGE}
142 -+
143 -+# Install-info-altdir does not actually exist.
144 -+# Maybe somebody will write it.
145 -+if test -x /usr/sbin/install-info-altdir; then
146 -+ echo install/${PACKAGE}: install Info links for ${FLAVOR}
147 -+ install-info-altdir --quiet --section "" "" --dirname=${FLAVOR} /usr/share/info/${PACKAGE}.info.gz
148 -+fi
149 -+
150 -+install -m 755 -d ${ELCDIR}
151 -+cd ${ELDIR}
152 -+FILES=`echo *.el`
153 -+cp ${FILES} ${ELCDIR}
154 -+cd ${ELCDIR}
155 -+
156 -+cat << EOF > path.el
157 -+(setq load-path (cons "." load-path) byte-compile-warnings nil)
158 -+EOF
159 -+${FLAVOR} ${FLAGS} ${FILES}
160 -+rm -f *.el path.el
161 -+
162 -+exit 0
163 -+++ varnish3-3.0.0/debian-test/README.Debian
164 -@@ -0,0 +1,6 @@
165 -+varnish3 for Debian
166 -+-------------------
167 -+
168 -+<possible notes regarding this package - if none, delete this file>
169 -+
170 -+ -- root <root@ragweed.knams.wikimedia.org> Mon, 18 Jul 2011 02:34:07 +0000
171 -+++ varnish3-3.0.0/debian-test/copyright
172 -@@ -0,0 +1,28 @@
173 -+This package was debianized by root <root@ragweed.knams.wikimedia.org> on
174 -+Mon, 18 Jul 2011 02:34:07 +0000.
175 -+
176 -+It was downloaded from <url://example.com>
177 -+
178 -+Upstream Author(s):
179 -+
180 -+ <put author's name and email here>
181 -+ <likewise for another author>
182 -+
183 -+Copyright:
184 -+
185 -+ <Copyright (C) YYYY Name OfAuthor>
186 -+ <likewise for another author>
187 -+
188 -+License:
189 -+
190 -+ <Put the license of the package here indented by 4 spaces>
191 -+
192 -+The Debian packaging is:
193 -+
194 -+ Copyright (C) 2011 root <root@ragweed.knams.wikimedia.org>
195 -+
196 -+and is licensed under the GPL version 3,
197 -+see `/usr/share/common-licenses/GPL-3'.
198 -+
199 -+# Please also look if there are files or directories which have a
200 -+# different copyright/license attached and list them here.
201 -+++ varnish3-3.0.0/debian-test/emacsen-remove.ex
202 -@@ -0,0 +1,15 @@
203 -+#!/bin/sh -e
204 -+# /usr/lib/emacsen-common/packages/remove/varnish3
205 -+
206 -+FLAVOR=$1
207 -+PACKAGE=varnish3
208 -+
209 -+if [ ${FLAVOR} != emacs ]; then
210 -+ if test -x /usr/sbin/install-info-altdir; then
211 -+ echo remove/${PACKAGE}: removing Info links for ${FLAVOR}
212 -+ install-info-altdir --quiet --remove --dirname=${FLAVOR} /usr/share/info/varnish3.info.gz
213 -+ fi
214 -+
215 -+ echo remove/${PACKAGE}: purging byte-compiled files for ${FLAVOR}
216 -+ rm -rf /usr/share/${FLAVOR}/site-lisp/${PACKAGE}
217 -+fi
218 -+++ varnish3-3.0.0/debian-test/watch.ex
219 -@@ -0,0 +1,23 @@
220 -+# Example watch control file for uscan
221 -+# Rename this file to "watch" and then you can run the "uscan" command
222 -+# to check for upstream updates and more.
223 -+# See uscan(1) for format
224 -+
225 -+# Compulsory line, this is a version 3 file
226 -+version=3
227 -+
228 -+# Uncomment to examine a Webpage
229 -+# <Webpage URL> <string match>
230 -+#http://www.example.com/downloads.php varnish3-(.*)\.tar\.gz
231 -+
232 -+# Uncomment to examine a Webserver directory
233 -+#http://www.example.com/pub/varnish3-(.*)\.tar\.gz
234 -+
235 -+# Uncommment to examine a FTP server
236 -+#ftp://ftp.example.com/pub/varnish3-(.*)\.tar\.gz debian uupdate
237 -+
238 -+# Uncomment to find new files on sourceforge, for devscripts >= 2.9
239 -+# http://sf.net/varnish3/varnish3-(.*)\.tar\.gz
240 -+
241 -+# Uncomment to find new files on GooglePages
242 -+# http://example.googlepages.com/foo.html varnish3-(.*)\.tar\.gz
243 -+++ varnish3-3.0.0/debian-test/menu.ex
244 -@@ -0,0 +1,2 @@
245 -+?package(varnish3):needs="X11|text|vc|wm" section="Applications/see-menu-manual"\
246 -+ title="varnish3" command="/usr/bin/varnish3"
247 -+++ varnish3-3.0.0/debian-test/manpage.1.ex
248 -@@ -0,0 +1,59 @@
249 -+.\" Hey, EMACS: -*- nroff -*-
250 -+.\" First parameter, NAME, should be all caps
251 -+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
252 -+.\" other parameters are allowed: see man(7), man(1)
253 -+.TH VARNISH3 SECTION "July 18, 2011"
254 -+.\" Please adjust this date whenever revising the manpage.
255 -+.\"
256 -+.\" Some roff macros, for reference:
257 -+.\" .nh disable hyphenation
258 -+.\" .hy enable hyphenation
259 -+.\" .ad l left justify
260 -+.\" .ad b justify to both left and right margins
261 -+.\" .nf disable filling
262 -+.\" .fi enable filling
263 -+.\" .br insert line break
264 -+.\" .sp <n> insert n+1 empty lines
265 -+.\" for manpage-specific macros, see man(7)
266 -+.SH NAME
267 -+varnish3 \- program to do something
268 -+.SH SYNOPSIS
269 -+.B varnish3
270 -+.RI [ options ] " files" ...
271 -+.br
272 -+.B bar
273 -+.RI [ options ] " files" ...
274 -+.SH DESCRIPTION
275 -+This manual page documents briefly the
276 -+.B varnish3
277 -+and
278 -+.B bar
279 -+commands.
280 -+.PP
281 -+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
282 -+.\" \fI<whatever>\fP escape sequences to invode bold face and italics,
283 -+.\" respectively.
284 -+\fBvarnish3\fP is a program that...
285 -+.SH OPTIONS
286 -+These programs follow the usual GNU command line syntax, with long
287 -+options starting with two dashes (`-').
288 -+A summary of options is included below.
289 -+For a complete description, see the Info files.
290 -+.TP
291 -+.B \-h, \-\-help
292 -+Show summary of options.
293 -+.TP
294 -+.B \-v, \-\-version
295 -+Show version of program.
296 -+.SH SEE ALSO
297 -+.BR bar (1),
298 -+.BR baz (1).
299 -+.br
300 -+The programs are documented fully by
301 -+.IR "The Rise and Fall of a Fooish Bar" ,
302 -+available via the Info system.
303 -+.SH AUTHOR
304 -+varnish3 was written by <upstream author>.
305 -+.PP
306 -+This manual page was written by root <root@ragweed.knams.wikimedia.org>,
307 -+for the Debian project (and may be used by others).
308 -+++ varnish3-3.0.0/debian-test/changelog
309 -@@ -0,0 +1,5 @@
310 -+varnish3 (3.0.0-1) unstable; urgency=low
311 -+
312 -+ * Initial release (Closes: #nnnn) <nnnn is the bug number of your ITP>
313 -+
314 -+ -- root <root@ragweed.knams.wikimedia.org> Mon, 18 Jul 2011 02:34:07 +0000
315 -+++ varnish3-3.0.0/debian-test/varnish3.doc-base.EX
316 -@@ -0,0 +1,20 @@
317 -+Document: varnish3
318 -+Title: Debian varnish3 Manual
319 -+Author: <insert document author here>
320 -+Abstract: This manual describes what varnish3 is
321 -+ and how it can be used to
322 -+ manage online manuals on Debian systems.
323 -+Section: unknown
324 -+
325 -+Format: debiandoc-sgml
326 -+Files: /usr/share/doc/varnish3/varnish3.sgml.gz
327 -+
328 -+Format: postscript
329 -+Files: /usr/share/doc/varnish3/varnish3.ps.gz
330 -+
331 -+Format: text
332 -+Files: /usr/share/doc/varnish3/varnish3.text.gz
333 -+
334 -+Format: HTML
335 -+Index: /usr/share/doc/varnish3/html/index.html
336 -+Files: /usr/share/doc/varnish3/html/*.html
337 -+++ varnish3-3.0.0/debian-test/cron.d.ex
338 -@@ -0,0 +1,4 @@
339 -+#
340 -+# Regular cron jobs for the varnish3 package
341 -+#
342 -+0 4 * * * root [ -x /usr/bin/varnish3_maintenance ] && /usr/bin/varnish3_maintenance
343 -+++ varnish3-3.0.0/debian-test/manpage.xml.ex
344 -@@ -0,0 +1,291 @@
345 -+<?xml version='1.0' encoding='UTF-8'?>
346 -+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
347 -+"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
348 -+
349 -+<!--
350 -+
351 -+`xsltproc -''-nonet \
352 -+ -''-param man.charmap.use.subset "0" \
353 -+ -''-param make.year.ranges "1" \
354 -+ -''-param make.single.year.ranges "1" \
355 -+ /usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl \
356 -+ manpage.xml'
357 -+
358 -+A manual page <package>.<section> will be generated. You may view the
359 -+manual page with: nroff -man <package>.<section> | less'. A typical entry
360 -+in a Makefile or Makefile.am is:
361 -+
362 -+DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
363 -+XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
364 -+
365 -+manpage.1: manpage.xml
366 -+ $(XP) $(DB2MAN) $<
367 -+
368 -+The xsltproc binary is found in the xsltproc package. The XSL files are in
369 -+docbook-xsl. A description of the parameters you can use can be found in the
370 -+docbook-xsl-doc-* packages. Please remember that if you create the nroff
371 -+version in one of the debian/rules file targets (such as build), you will need
372 -+to include xsltproc and docbook-xsl in your Build-Depends control field.
373 -+Alternatively use the xmlto command/package. That will also automatically
374 -+pull in xsltproc and docbook-xsl.
375 -+
376 -+Notes for using docbook2x: docbook2x-man does not automatically create the
377 -+AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as
378 -+<refsect1> ... </refsect1>.
379 -+
380 -+To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections
381 -+read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be
382 -+found in the docbook-xsl-doc-html package.
383 -+
384 -+Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
385 -+
386 -+General documentation about man-pages and man-page-formatting:
387 -+man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
388 -+
389 -+-->
390 -+
391 -+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
392 -+ <!ENTITY dhfirstname "FIRSTNAME">
393 -+ <!ENTITY dhsurname "SURNAME">
394 -+ <!-- dhusername could also be set to "&firstname; &surname;". -->
395 -+ <!ENTITY dhusername "root">
396 -+ <!ENTITY dhemail "root@ragweed.knams.wikimedia.org">
397 -+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
398 -+ allowed: see man(7), man(1) and
399 -+ http://www.tldp.org/HOWTO/Man-Page/q2.html. -->
400 -+ <!ENTITY dhsection "SECTION">
401 -+ <!-- TITLE should be something like "User commands" or similar (see
402 -+ http://www.tldp.org/HOWTO/Man-Page/q2.html). -->
403 -+ <!ENTITY dhtitle "varnish3 User Manual">
404 -+ <!ENTITY dhucpackage "VARNISH3">
405 -+ <!ENTITY dhpackage "varnish3">
406 -+]>
407 -+
408 -+<refentry>
409 -+ <refentryinfo>
410 -+ <title>&dhtitle;</title>
411 -+ <productname>&dhpackage;</productname>
412 -+ <authorgroup>
413 -+ <author>
414 -+ <firstname>&dhfirstname;</firstname>
415 -+ <surname>&dhsurname;</surname>
416 -+ <contrib>Wrote this manpage for the Debian system.</contrib>
417 -+ <address>
418 -+ <email>&dhemail;</email>
419 -+ </address>
420 -+ </author>
421 -+ </authorgroup>
422 -+ <copyright>
423 -+ <year>2007</year>
424 -+ <holder>&dhusername;</holder>
425 -+ </copyright>
426 -+ <legalnotice>
427 -+ <para>This manual page was written for the Debian system
428 -+ (and may be used by others).</para>
429 -+ <para>Permission is granted to copy, distribute and/or modify this
430 -+ document under the terms of the GNU General Public License,
431 -+ Version 2 or (at your option) any later version published by
432 -+ the Free Software Foundation.</para>
433 -+ <para>On Debian systems, the complete text of the GNU General Public
434 -+ License can be found in
435 -+ <filename>/usr/share/common-licenses/GPL</filename>.</para>
436 -+ </legalnotice>
437 -+ </refentryinfo>
438 -+ <refmeta>
439 -+ <refentrytitle>&dhucpackage;</refentrytitle>
440 -+ <manvolnum>&dhsection;</manvolnum>
441 -+ </refmeta>
442 -+ <refnamediv>
443 -+ <refname>&dhpackage;</refname>
444 -+ <refpurpose>program to do something</refpurpose>
445 -+ </refnamediv>
446 -+ <refsynopsisdiv>
447 -+ <cmdsynopsis>
448 -+ <command>&dhpackage;</command>
449 -+ <!-- These are several examples, how syntaxes could look -->
450 -+ <arg choice="plain"><option>-e <replaceable>this</replaceable></option></arg>
451 -+ <arg choice="opt"><option>--example=<parameter>that</parameter></option></arg>
452 -+ <arg choice="opt">
453 -+ <group choice="req">
454 -+ <arg choice="plain"><option>-e</option></arg>
455 -+ <arg choice="plain"><option>--example</option></arg>
456 -+ </group>
457 -+ <replaceable class="option">this</replaceable>
458 -+ </arg>
459 -+ <arg choice="opt">
460 -+ <group choice="req">
461 -+ <arg choice="plain"><option>-e</option></arg>
462 -+ <arg choice="plain"><option>--example</option></arg>
463 -+ </group>
464 -+ <group choice="req">
465 -+ <arg choice="plain"><replaceable>this</replaceable></arg>
466 -+ <arg choice="plain"><replaceable>that</replaceable></arg>
467 -+ </group>
468 -+ </arg>
469 -+ </cmdsynopsis>
470 -+ <cmdsynopsis>
471 -+ <command>&dhpackage;</command>
472 -+ <!-- Normally the help and version options make the programs stop
473 -+ right after outputting the requested information. -->
474 -+ <group choice="opt">
475 -+ <arg choice="plain">
476 -+ <group choice="req">
477 -+ <arg choice="plain"><option>-h</option></arg>
478 -+ <arg choice="plain"><option>--help</option></arg>
479 -+ </group>
480 -+ </arg>
481 -+ <arg choice="plain">
482 -+ <group choice="req">
483 -+ <arg choice="plain"><option>-v</option></arg>
484 -+ <arg choice="plain"><option>--version</option></arg>
485 -+ </group>
486 -+ </arg>
487 -+ </group>
488 -+ </cmdsynopsis>
489 -+ </refsynopsisdiv>
490 -+ <refsect1 id="description">
491 -+ <title>DESCRIPTION</title>
492 -+ <para>This manual page documents briefly the
493 -+ <command>&dhpackage;</command> and <command>bar</command>
494 -+ commands.</para>
495 -+ <para>This manual page was written for the Debian distribution
496 -+ because the original program does not have a manual page.
497 -+ Instead, it has documentation in the GNU <citerefentry>
498 -+ <refentrytitle>info</refentrytitle>
499 -+ <manvolnum>1</manvolnum>
500 -+ </citerefentry> format; see below.</para>
501 -+ <para><command>&dhpackage;</command> is a program that...</para>
502 -+ </refsect1>
503 -+ <refsect1 id="options">
504 -+ <title>OPTIONS</title>
505 -+ <para>The program follows the usual GNU command line syntax,
506 -+ with long options starting with two dashes (`-'). A summary of
507 -+ options is included below. For a complete description, see the
508 -+ <citerefentry>
509 -+ <refentrytitle>info</refentrytitle>
510 -+ <manvolnum>1</manvolnum>
511 -+ </citerefentry> files.</para>
512 -+ <variablelist>
513 -+ <!-- Use the variablelist.term.separator and the
514 -+ variablelist.term.break.after parameters to
515 -+ control the term elements. -->
516 -+ <varlistentry>
517 -+ <term><option>-e <replaceable>this</replaceable></option></term>
518 -+ <term><option>--example=<replaceable>that</replaceable></option></term>
519 -+ <listitem>
520 -+ <para>Does this and that.</para>
521 -+ </listitem>
522 -+ </varlistentry>
523 -+ <varlistentry>
524 -+ <term><option>-h</option></term>
525 -+ <term><option>--help</option></term>
526 -+ <listitem>
527 -+ <para>Show summary of options.</para>
528 -+ </listitem>
529 -+ </varlistentry>
530 -+ <varlistentry>
531 -+ <term><option>-v</option></term>
532 -+ <term><option>--version</option></term>
533 -+ <listitem>
534 -+ <para>Show version of program.</para>
535 -+ </listitem>
536 -+ </varlistentry>
537 -+ </variablelist>
538 -+ </refsect1>
539 -+ <refsect1 id="files">
540 -+ <title>FILES</title>
541 -+ <variablelist>
542 -+ <varlistentry>
543 -+ <term><filename>/etc/foo.conf</filename></term>
544 -+ <listitem>
545 -+ <para>The system-wide configuration file to control the
546 -+ behaviour of <application>&dhpackage;</application>. See
547 -+ <citerefentry>
548 -+ <refentrytitle>foo.conf</refentrytitle>
549 -+ <manvolnum>5</manvolnum>
550 -+ </citerefentry> for further details.</para>
551 -+ </listitem>
552 -+ </varlistentry>
553 -+ <varlistentry>
554 -+ <term><filename>${HOME}/.foo.conf</filename></term>
555 -+ <listitem>
556 -+ <para>The per-user configuration file to control the
557 -+ behaviour of <application>&dhpackage;</application>. See
558 -+ <citerefentry>
559 -+ <refentrytitle>foo.conf</refentrytitle>
560 -+ <manvolnum>5</manvolnum>
561 -+ </citerefentry> for further details.</para>
562 -+ </listitem>
563 -+ </varlistentry>
564 -+ </variablelist>
565 -+ </refsect1>
566 -+ <refsect1 id="environment">
567 -+ <title>ENVIONMENT</title>
568 -+ <variablelist>
569 -+ <varlistentry>
570 -+ <term><envar>FOO_CONF</envar></term>
571 -+ <listitem>
572 -+ <para>If used, the defined file is used as configuration
573 -+ file (see also <xref linkend="files"/>).</para>
574 -+ </listitem>
575 -+ </varlistentry>
576 -+ </variablelist>
577 -+ </refsect1>
578 -+ <refsect1 id="diagnostics">
579 -+ <title>DIAGNOSTICS</title>
580 -+ <para>The following diagnostics may be issued
581 -+ on <filename class="devicefile">stderr</filename>:</para>
582 -+ <variablelist>
583 -+ <varlistentry>
584 -+ <term><errortext>Bad configuration file. Exiting.</errortext></term>
585 -+ <listitem>
586 -+ <para>The configuration file seems to contain a broken configuration
587 -+ line. Use the <option>--verbose</option> option, to get more info.
588 -+ </para>
589 -+ </listitem>
590 -+ </varlistentry>
591 -+ </variablelist>
592 -+ <para><command>&dhpackage;</command> provides some return codes, that can
593 -+ be used in scripts:</para>
594 -+ <segmentedlist>
595 -+ <segtitle>Code</segtitle>
596 -+ <segtitle>Diagnostic</segtitle>
597 -+ <seglistitem>
598 -+ <seg><errorcode>0</errorcode></seg>
599 -+ <seg>Program exited successfully.</seg>
600 -+ </seglistitem>
601 -+ <seglistitem>
602 -+ <seg><errorcode>1</errorcode></seg>
603 -+ <seg>The configuration file seems to be broken.</seg>
604 -+ </seglistitem>
605 -+ </segmentedlist>
606 -+ </refsect1>
607 -+ <refsect1 id="bugs">
608 -+ <!-- Or use this section to tell about upstream BTS. -->
609 -+ <title>BUGS</title>
610 -+ <para>The program is currently limited to only work
611 -+ with the <package>foobar</package> library.</para>
612 -+ <para>The upstreams <acronym>BTS</acronym> can be found
613 -+ at <ulink url="http://bugzilla.foo.tld"/>.</para>
614 -+ </refsect1>
615 -+ <refsect1 id="see_also">
616 -+ <title>SEE ALSO</title>
617 -+ <!-- In alpabetical order. -->
618 -+ <para><citerefentry>
619 -+ <refentrytitle>bar</refentrytitle>
620 -+ <manvolnum>1</manvolnum>
621 -+ </citerefentry>, <citerefentry>
622 -+ <refentrytitle>baz</refentrytitle>
623 -+ <manvolnum>1</manvolnum>
624 -+ </citerefentry>, <citerefentry>
625 -+ <refentrytitle>foo.conf</refentrytitle>
626 -+ <manvolnum>5</manvolnum>
627 -+ </citerefentry></para>
628 -+ <para>The programs are documented fully by <citetitle>The Rise and
629 -+ Fall of a Fooish Bar</citetitle> available via the <citerefentry>
630 -+ <refentrytitle>info</refentrytitle>
631 -+ <manvolnum>1</manvolnum>
632 -+ </citerefentry> system.</para>
633 -+ </refsect1>
634 -+</refentry>
635 -+
636 -+++ varnish3-3.0.0/debian-test/rules
637 -@@ -0,0 +1,137 @@
638 -+#!/usr/bin/make -f
639 -+# -*- makefile -*-
640 -+# Sample debian/rules that uses debhelper.
641 -+#
642 -+# This file was originally written by Joey Hess and Craig Small.
643 -+# As a special exception, when this file is copied by dh-make into a
644 -+# dh-make output file, you may use that output file without restriction.
645 -+# This special exception was added by Craig Small in version 0.37 of dh-make.
646 -+#
647 -+# Modified to make a template file for a multi-binary package with separated
648 -+# build-arch and build-indep targets by Bill Allombert 2001
649 -+
650 -+# Uncomment this to turn on verbose mode.
651 -+#export DH_VERBOSE=1
652 -+
653 -+# This has to be exported to make some magic below work.
654 -+export DH_OPTIONS
655 -+
656 -+# These are used for cross-compiling and for saving the configure script
657 -+# from having to guess our platform (since we know it already)
658 -+DEB_HOST_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
659 -+DEB_BUILD_GNU_TYPE ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
660 -+ifneq ($(DEB_HOST_GNU_TYPE),$(DEB_BUILD_GNU_TYPE))
661 -+CROSS= --build $(DEB_BUILD_GNU_TYPE) --host $(DEB_HOST_GNU_TYPE)
662 -+else
663 -+CROSS= --build $(DEB_BUILD_GNU_TYPE)
664 -+endif
665 -+
666 -+
667 -+
668 -+include /usr/share/dpatch/dpatch.make
669 -+
670 -+config.status: configure
671 -+ dh_testdir
672 -+ # Add here commands to configure the package.
673 -+ifneq "$(wildcard /usr/share/misc/config.sub)" ""
674 -+ cp -f /usr/share/misc/config.sub config.sub
675 -+endif
676 -+ifneq "$(wildcard /usr/share/misc/config.guess)" ""
677 -+ cp -f /usr/share/misc/config.guess config.guess
678 -+endif
679 -+ ./configure $(CROSS) --prefix=/usr --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info CFLAGS="$(CFLAGS)" LDFLAGS="-Wl,-z,defs"
680 -+
681 -+
682 -+#Architecture
683 -+build: build-arch build-indep
684 -+
685 -+build-arch: build-arch-stamp
686 -+build-arch-stamp: config.status patch-stamp
687 -+
688 -+ # Add here commands to compile the arch part of the package.
689 -+ #$(MAKE)
690 -+ touch $@
691 -+
692 -+build-indep: build-indep-stamp
693 -+build-indep-stamp: config.status patch-stamp
694 -+
695 -+ # Add here commands to compile the indep part of the package.
696 -+ #$(MAKE) doc
697 -+ touch $@
698 -+
699 -+clean: unpatch
700 -+ dh_testdir
701 -+ dh_testroot
702 -+ rm -f build-arch-stamp build-indep-stamp
703 -+
704 -+ # Add here commands to clean up after the build process.
705 -+ [ ! -f Makefile ] || $(MAKE) distclean
706 -+ rm -f config.sub config.guess
707 -+
708 -+ dh_clean
709 -+
710 -+install: install-indep install-arch
711 -+install-indep:
712 -+ dh_testdir
713 -+ dh_testroot
714 -+ dh_prep -i
715 -+ dh_installdirs -i
716 -+
717 -+ # Add here commands to install the indep part of the package into
718 -+ # debian/<package>-doc.
719 -+ #INSTALLDOC#
720 -+
721 -+ dh_install -i
722 -+
723 -+install-arch:
724 -+ dh_testdir
725 -+ dh_testroot
726 -+ dh_prep -s
727 -+ dh_installdirs -s
728 -+
729 -+ # Add here commands to install the arch part of the package into
730 -+ # debian/tmp.
731 -+ $(MAKE) DESTDIR=$(CURDIR)/debian/varnish3 install
732 -+
733 -+ dh_install -s
734 -+# Must not depend on anything. This is to be called by
735 -+# binary-arch/binary-indep
736 -+# in another 'make' thread.
737 -+binary-common:
738 -+ dh_testdir
739 -+ dh_testroot
740 -+ dh_installchangelogs ChangeLog
741 -+ dh_installdocs
742 -+ dh_installexamples
743 -+# dh_installmenu
744 -+# dh_installdebconf
745 -+# dh_installlogrotate
746 -+# dh_installemacsen
747 -+# dh_installpam
748 -+# dh_installmime
749 -+# dh_python
750 -+# dh_installinit
751 -+# dh_installcron
752 -+# dh_installinfo
753 -+ dh_installman
754 -+ dh_link
755 -+ dh_strip
756 -+ dh_compress
757 -+ dh_fixperms
758 -+# dh_perl
759 -+ dh_makeshlibs
760 -+ dh_installdeb
761 -+ dh_shlibdeps
762 -+ dh_gencontrol
763 -+ dh_md5sums
764 -+ dh_builddeb
765 -+# Build architecture independant packages using the common target.
766 -+binary-indep: build-indep install-indep
767 -+ $(MAKE) -f debian/rules DH_OPTIONS=-i binary-common
768 -+
769 -+# Build architecture dependant packages using the common target.
770 -+binary-arch: build-arch install-arch
771 -+ $(MAKE) -f debian/rules DH_OPTIONS=-s binary-common
772 -+
773 -+binary: binary-arch binary-indep
774 -+.PHONY: build clean binary-indep binary-arch binary install install-indep install-arch
775 -+++ varnish3-3.0.0/debian-test/prerm.ex
776 -@@ -0,0 +1,38 @@
777 -+#!/bin/sh
778 -+# prerm script for varnish3
779 -+#
780 -+# see: dh_installdeb(1)
781 -+
782 -+set -e
783 -+
784 -+# summary of how this script can be called:
785 -+# * <prerm> `remove'
786 -+# * <old-prerm> `upgrade' <new-version>
787 -+# * <new-prerm> `failed-upgrade' <old-version>
788 -+# * <conflictor's-prerm> `remove' `in-favour' <package> <new-version>
789 -+# * <deconfigured's-prerm> `deconfigure' `in-favour'
790 -+# <package-being-installed> <version> `removing'
791 -+# <conflicting-package> <version>
792 -+# for details, see http://www.debian.org/doc/debian-policy/ or
793 -+# the debian-policy package
794 -+
795 -+
796 -+case "$1" in
797 -+ remove|upgrade|deconfigure)
798 -+ ;;
799 -+
800 -+ failed-upgrade)
801 -+ ;;
802 -+
803 -+ *)
804 -+ echo "prerm called with unknown argument \`$1'" >&2
805 -+ exit 1
806 -+ ;;
807 -+esac
808 -+
809 -+# dh_installdeb will replace this with shell code automatically
810 -+# generated by other debhelper scripts.
811 -+
812 -+#DEBHELPER#
813 -+
814 -+exit 0
815 -+++ varnish3-3.0.0/debian-test/postinst.ex
816 -@@ -0,0 +1,39 @@
817 -+#!/bin/sh
818 -+# postinst script for varnish3
819 -+#
820 -+# see: dh_installdeb(1)
821 -+
822 -+set -e
823 -+
824 -+# summary of how this script can be called:
825 -+# * <postinst> `configure' <most-recently-configured-version>
826 -+# * <old-postinst> `abort-upgrade' <new version>
827 -+# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
828 -+# <new-version>
829 -+# * <postinst> `abort-remove'
830 -+# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
831 -+# <failed-install-package> <version> `removing'
832 -+# <conflicting-package> <version>
833 -+# for details, see http://www.debian.org/doc/debian-policy/ or
834 -+# the debian-policy package
835 -+
836 -+
837 -+case "$1" in
838 -+ configure)
839 -+ ;;
840 -+
841 -+ abort-upgrade|abort-remove|abort-deconfigure)
842 -+ ;;
843 -+
844 -+ *)
845 -+ echo "postinst called with unknown argument \`$1'" >&2
846 -+ exit 1
847 -+ ;;
848 -+esac
849 -+
850 -+# dh_installdeb will replace this with shell code automatically
851 -+# generated by other debhelper scripts.
852 -+
853 -+#DEBHELPER#
854 -+
855 -+exit 0
856 -+++ varnish3-3.0.0/debian-test/varnish3-doc.install
857 -@@ -0,0 +1 @@
858 -+#DOCS#
859 -+++ varnish3-3.0.0/debian-test/docs
860 -@@ -0,0 +1 @@
861 -+README
862 -+++ varnish3-3.0.0/debian-test/init.d.lsb.ex
863 -@@ -0,0 +1,296 @@
864 -+#!/bin/sh
865 -+#
866 -+# Example init.d script with LSB support.
867 -+#
868 -+# Please read this init.d carefully and modify the sections to
869 -+# adjust it to the program you want to run.
870 -+#
871 -+# Copyright (c) 2007 Javier Fernandez-Sanguino <jfs@debian.org>
872 -+#
873 -+# This is free software; you may redistribute it and/or modify
874 -+# it under the terms of the GNU General Public License as
875 -+# published by the Free Software Foundation; either version 2,
876 -+# or (at your option) any later version.
877 -+#
878 -+# This is distributed in the hope that it will be useful, but
879 -+# WITHOUT ANY WARRANTY; without even the implied warranty of
880 -+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
881 -+# GNU General Public License for more details.
882 -+#
883 -+# You should have received a copy of the GNU General Public License with
884 -+# the Debian operating system, in /usr/share/common-licenses/GPL; if
885 -+# not, write to the Free Software Foundation, Inc., 59 Temple Place,
886 -+# Suite 330, Boston, MA 02111-1307 USA
887 -+#
888 -+### BEGIN INIT INFO
889 -+# Provides: varnish3
890 -+# Required-Start: $network $local_fs
891 -+# Required-Stop:
892 -+# Should-Start: $named
893 -+# Should-Stop:
894 -+# Default-Start: 2 3 4 5
895 -+# Default-Stop: 0 1 6
896 -+# Short-Description: <Enter a short description of the sortware>
897 -+# Description: <Enter a long description of the software>
898 -+# <...>
899 -+# <...>
900 -+### END INIT INFO
901 -+
902 -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
903 -+
904 -+DAEMON=/usr/sbin/varnish3 # Introduce the server's location here
905 -+NAME=#PACKAGE # Introduce the short server's name here
906 -+DESC=#PACKAGE # Introduce a short description here
907 -+LOGDIR=/var/log/varnish3 # Log directory to use
908 -+
909 -+PIDFILE=/var/run/$NAME.pid
910 -+
911 -+test -x $DAEMON || exit 0
912 -+
913 -+. /lib/lsb/init-functions
914 -+
915 -+# Default options, these can be overriden by the information
916 -+# at /etc/default/$NAME
917 -+DAEMON_OPTS="" # Additional options given to the server
918 -+
919 -+DIETIME=10 # Time to wait for the server to die, in seconds
920 -+ # If this value is set too low you might not
921 -+ # let some servers to die gracefully and
922 -+ # 'restart' will not work
923 -+
924 -+#STARTTIME=2 # Time to wait for the server to start, in seconds
925 -+ # If this value is set each time the server is
926 -+ # started (on start or restart) the script will
927 -+ # stall to try to determine if it is running
928 -+ # If it is not set and the server takes time
929 -+ # to setup a pid file the log message might
930 -+ # be a false positive (says it did not start
931 -+ # when it actually did)
932 -+
933 -+LOGFILE=$LOGDIR/$NAME.log # Server logfile
934 -+#DAEMONUSER=varnish3 # Users to run the daemons as. If this value
935 -+ # is set start-stop-daemon will chuid the server
936 -+
937 -+# Include defaults if available
938 -+if [ -f /etc/default/$NAME ] ; then
939 -+ . /etc/default/$NAME
940 -+fi
941 -+
942 -+# Use this if you want the user to explicitly set 'RUN' in
943 -+# /etc/default/
944 -+#if [ "x$RUN" != "xyes" ] ; then
945 -+# log_failure_msg "$NAME disabled, please adjust the configuration to your needs "
946 -+# log_failure_msg "and then set RUN to 'yes' in /etc/default/$NAME to enable it."
947 -+# exit 1
948 -+#fi
949 -+
950 -+# Check that the user exists (if we set a user)
951 -+# Does the user exist?
952 -+if [ -n "$DAEMONUSER" ] ; then
953 -+ if getent passwd | grep -q "^$DAEMONUSER:"; then
954 -+ # Obtain the uid and gid
955 -+ DAEMONUID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $3}'`
956 -+ DAEMONGID=`getent passwd |grep "^$DAEMONUSER:" | awk -F : '{print $4}'`
957 -+ else
958 -+ log_failure_msg "The user $DAEMONUSER, required to run $NAME does not exist."
959 -+ exit 1
960 -+ fi
961 -+fi
962 -+
963 -+
964 -+set -e
965 -+
966 -+running_pid() {
967 -+# Check if a given process pid's cmdline matches a given name
968 -+ pid=$1
969 -+ name=$2
970 -+ [ -z "$pid" ] && return 1
971 -+ [ ! -d /proc/$pid ] && return 1
972 -+ cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
973 -+ # Is this the expected server
974 -+ [ "$cmd" != "$name" ] && return 1
975 -+ return 0
976 -+}
977 -+
978 -+running() {
979 -+# Check if the process is running looking at /proc
980 -+# (works for all users)
981 -+
982 -+ # No pidfile, probably no daemon present
983 -+ [ ! -f "$PIDFILE" ] && return 1
984 -+ pid=`cat $PIDFILE`
985 -+ running_pid $pid $DAEMON || return 1
986 -+ return 0
987 -+}
988 -+
989 -+start_server() {
990 -+# Start the process using the wrapper
991 -+ if [ -z "$DAEMONUSER" ] ; then
992 -+ start_daemon -p $PIDFILE $DAEMON $DAEMON_OPTS
993 -+ errcode=$?
994 -+ else
995 -+# if we are using a daemonuser then change the user id
996 -+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
997 -+ --chuid $DAEMONUSER \
998 -+ --exec $DAEMON -- $DAEMON_OPTS
999 -+ errcode=$?
1000 -+ fi
1001 -+ return $errcode
1002 -+}
1003 -+
1004 -+stop_server() {
1005 -+# Stop the process using the wrapper
1006 -+ if [ -z "$DAEMONUSER" ] ; then
1007 -+ killproc -p $PIDFILE $DAEMON
1008 -+ errcode=$?
1009 -+ else
1010 -+# if we are using a daemonuser then look for process that match
1011 -+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
1012 -+ --user $DAEMONUSER \
1013 -+ --exec $DAEMON
1014 -+ errcode=$?
1015 -+ fi
1016 -+
1017 -+ return $errcode
1018 -+}
1019 -+
1020 -+reload_server() {
1021 -+ [ ! -f "$PIDFILE" ] && return 1
1022 -+ pid=pidofproc $PIDFILE # This is the daemon's pid
1023 -+ # Send a SIGHUP
1024 -+ kill -1 $pid
1025 -+ return $?
1026 -+}
1027 -+
1028 -+force_stop() {
1029 -+# Force the process to die killing it manually
1030 -+ [ ! -e "$PIDFILE" ] && return
1031 -+ if running ; then
1032 -+ kill -15 $pid
1033 -+ # Is it really dead?
1034 -+ sleep "$DIETIME"s
1035 -+ if running ; then
1036 -+ kill -9 $pid
1037 -+ sleep "$DIETIME"s
1038 -+ if running ; then
1039 -+ echo "Cannot kill $NAME (pid=$pid)!"
1040 -+ exit 1
1041 -+ fi
1042 -+ fi
1043 -+ fi
1044 -+ rm -f $PIDFILE
1045 -+}
1046 -+
1047 -+
1048 -+case "$1" in
1049 -+ start)
1050 -+ log_daemon_msg "Starting $DESC " "$NAME"
1051 -+ # Check if it's running first
1052 -+ if running ; then
1053 -+ log_progress_msg "apparently already running"
1054 -+ log_end_msg 0
1055 -+ exit 0
1056 -+ fi
1057 -+ if start_server ; then
1058 -+ # NOTE: Some servers might die some time after they start,
1059 -+ # this code will detect this issue if STARTTIME is set
1060 -+ # to a reasonable value
1061 -+ [ -n "$STARTTIME" ] && sleep $STARTTIME # Wait some time
1062 -+ if running ; then
1063 -+ # It's ok, the server started and is running
1064 -+ log_end_msg 0
1065 -+ else
1066 -+ # It is not running after we did start
1067 -+ log_end_msg 1
1068 -+ fi
1069 -+ else
1070 -+ # Either we could not start it
1071 -+ log_end_msg 1
1072 -+ fi
1073 -+ ;;
1074 -+ stop)
1075 -+ log_daemon_msg "Stopping $DESC" "$NAME"
1076 -+ if running ; then
1077 -+ # Only stop the server if we see it running
1078 -+ errcode=0
1079 -+ stop_server || errcode=$?
1080 -+ log_end_msg $errcode
1081 -+ else
1082 -+ # If it's not running don't do anything
1083 -+ log_progress_msg "apparently not running"
1084 -+ log_end_msg 0
1085 -+ exit 0
1086 -+ fi
1087 -+ ;;
1088 -+ force-stop)
1089 -+ # First try to stop gracefully the program
1090 -+ $0 stop
1091 -+ if running; then
1092 -+ # If it's still running try to kill it more forcefully
1093 -+ log_daemon_msg "Stopping (force) $DESC" "$NAME"
1094 -+ errcode=0
1095 -+ force_stop || errcode=$?
1096 -+ log_end_msg $errcode
1097 -+ fi
1098 -+ ;;
1099 -+ restart|force-reload)
1100 -+ log_daemon_msg "Restarting $DESC" "$NAME"
1101 -+ errcode=0
1102 -+ stop_server || errcode=$?
1103 -+ # Wait some sensible amount, some server need this
1104 -+ [ -n "$DIETIME" ] && sleep $DIETIME
1105 -+ start_server || errcode=$?
1106 -+ [ -n "$STARTTIME" ] && sleep $STARTTIME
1107 -+ running || errcode=$?
1108 -+ log_end_msg $errcode
1109 -+ ;;
1110 -+ status)
1111 -+
1112 -+ log_daemon_msg "Checking status of $DESC" "$NAME"
1113 -+ if running ; then
1114 -+ log_progress_msg "running"
1115 -+ log_end_msg 0
1116 -+ else
1117 -+ log_progress_msg "apparently not running"
1118 -+ log_end_msg 1
1119 -+ exit 1
1120 -+ fi
1121 -+ ;;
1122 -+ # Use this if the daemon cannot reload
1123 -+ reload)
1124 -+ log_warning_msg "Reloading $NAME daemon: not implemented, as the daemon"
1125 -+ log_warning_msg "cannot re-read the config file (use restart)."
1126 -+ ;;
1127 -+ # And this if it cann
1128 -+ #reload)
1129 -+ #
1130 -+ # If the daemon can reload its config files on the fly
1131 -+ # for example by sending it SIGHUP, do it here.
1132 -+ #
1133 -+ # If the daemon responds to changes in its config file
1134 -+ # directly anyway, make this a do-nothing entry.
1135 -+ #
1136 -+ # log_daemon_msg "Reloading $DESC configuration files" "$NAME"
1137 -+ # if running ; then
1138 -+ # reload_server
1139 -+ # if ! running ; then
1140 -+ # Process died after we tried to reload
1141 -+ # log_progress_msg "died on reload"
1142 -+ # log_end_msg 1
1143 -+ # exit 1
1144 -+ # fi
1145 -+ # else
1146 -+ # log_progress_msg "server is not running"
1147 -+ # log_end_msg 1
1148 -+ # exit 1
1149 -+ # fi
1150 -+ #;;
1151 -+
1152 -+ *)
1153 -+ N=/etc/init.d/$NAME
1154 -+ echo "Usage: $N {start|stop|force-stop|restart|force-reload|status}" >&2
1155 -+ exit 1
1156 -+ ;;
1157 -+esac
1158 -+
1159 -+exit 0
1160 -+++ varnish3-3.0.0/debian-test/postrm.ex
1161 -@@ -0,0 +1,37 @@
1162 -+#!/bin/sh
1163 -+# postrm script for varnish3
1164 -+#
1165 -+# see: dh_installdeb(1)
1166 -+
1167 -+set -e
1168 -+
1169 -+# summary of how this script can be called:
1170 -+# * <postrm> `remove'
1171 -+# * <postrm> `purge'
1172 -+# * <old-postrm> `upgrade' <new-version>
1173 -+# * <new-postrm> `failed-upgrade' <old-version>
1174 -+# * <new-postrm> `abort-install'
1175 -+# * <new-postrm> `abort-install' <old-version>
1176 -+# * <new-postrm> `abort-upgrade' <old-version>
1177 -+# * <disappearer's-postrm> `disappear' <overwriter>
1178 -+# <overwriter-version>
1179 -+# for details, see http://www.debian.org/doc/debian-policy/ or
1180 -+# the debian-policy package
1181 -+
1182 -+
1183 -+case "$1" in
1184 -+ purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
1185 -+ ;;
1186 -+
1187 -+ *)
1188 -+ echo "postrm called with unknown argument \`$1'" >&2
1189 -+ exit 1
1190 -+ ;;
1191 -+esac
1192 -+
1193 -+# dh_installdeb will replace this with shell code automatically
1194 -+# generated by other debhelper scripts.
1195 -+
1196 -+#DEBHELPER#
1197 -+
1198 -+exit 0
1199 -+++ varnish3-3.0.0/debian-test/manpage.sgml.ex
1200 -@@ -0,0 +1,154 @@
1201 -+<!doctype refentry PUBLIC "-//OASIS//DTD DocBook V4.1//EN" [
1202 -+
1203 -+<!-- Process this file with docbook-to-man to generate an nroff manual
1204 -+ page: `docbook-to-man manpage.sgml > manpage.1'. You may view
1205 -+ the manual page with: `docbook-to-man manpage.sgml | nroff -man |
1206 -+ less'. A typical entry in a Makefile or Makefile.am is:
1207 -+
1208 -+manpage.1: manpage.sgml
1209 -+ docbook-to-man $< > $@
1210 -+
1211 -+
1212 -+ The docbook-to-man binary is found in the docbook-to-man package.
1213 -+ Please remember that if you create the nroff version in one of the
1214 -+ debian/rules file targets (such as build), you will need to include
1215 -+ docbook-to-man in your Build-Depends control field.
1216 -+
1217 -+ -->
1218 -+
1219 -+ <!-- Fill in your name for FIRSTNAME and SURNAME. -->
1220 -+ <!ENTITY dhfirstname "<firstname>FIRSTNAME</firstname>">
1221 -+ <!ENTITY dhsurname "<surname>SURNAME</surname>">
1222 -+ <!-- Please adjust the date whenever revising the manpage. -->
1223 -+ <!ENTITY dhdate "<date>July 18, 2011</date>">
1224 -+ <!-- SECTION should be 1-8, maybe w/ subsection other parameters are
1225 -+ allowed: see man(7), man(1). -->
1226 -+ <!ENTITY dhsection "<manvolnum>SECTION</manvolnum>">
1227 -+ <!ENTITY dhemail "<email>root@ragweed.knams.wikimedia.org</email>">
1228 -+ <!ENTITY dhusername "root">
1229 -+ <!ENTITY dhucpackage "<refentrytitle>VARNISH3</refentrytitle>">
1230 -+ <!ENTITY dhpackage "varnish3">
1231 -+
1232 -+ <!ENTITY debian "<productname>Debian</productname>">
1233 -+ <!ENTITY gnu "<acronym>GNU</acronym>">
1234 -+ <!ENTITY gpl "&gnu; <acronym>GPL</acronym>">
1235 -+]>
1236 -+
1237 -+<refentry>
1238 -+ <refentryinfo>
1239 -+ <address>
1240 -+ &dhemail;
1241 -+ </address>
1242 -+ <author>
1243 -+ &dhfirstname;
1244 -+ &dhsurname;
1245 -+ </author>
1246 -+ <copyright>
1247 -+ <year>2003</year>
1248 -+ <holder>&dhusername;</holder>
1249 -+ </copyright>
1250 -+ &dhdate;
1251 -+ </refentryinfo>
1252 -+ <refmeta>
1253 -+ &dhucpackage;
1254 -+
1255 -+ &dhsection;
1256 -+ </refmeta>
1257 -+ <refnamediv>
1258 -+ <refname>&dhpackage;</refname>
1259 -+
1260 -+ <refpurpose>program to do something</refpurpose>
1261 -+ </refnamediv>
1262 -+ <refsynopsisdiv>
1263 -+ <cmdsynopsis>
1264 -+ <command>&dhpackage;</command>
1265 -+
1266 -+ <arg><option>-e <replaceable>this</replaceable></option></arg>
1267 -+
1268 -+ <arg><option>--example <replaceable>that</replaceable></option></arg>
1269 -+ </cmdsynopsis>
1270 -+ </refsynopsisdiv>
1271 -+ <refsect1>
1272 -+ <title>DESCRIPTION</title>
1273 -+
1274 -+ <para>This manual page documents briefly the
1275 -+ <command>&dhpackage;</command> and <command>bar</command>
1276 -+ commands.</para>
1277 -+
1278 -+ <para>This manual page was written for the &debian; distribution
1279 -+ because the original program does not have a manual page.
1280 -+ Instead, it has documentation in the &gnu;
1281 -+ <application>Info</application> format; see below.</para>
1282 -+
1283 -+ <para><command>&dhpackage;</command> is a program that...</para>
1284 -+
1285 -+ </refsect1>
1286 -+ <refsect1>
1287 -+ <title>OPTIONS</title>
1288 -+
1289 -+ <para>These programs follow the usual &gnu; command line syntax,
1290 -+ with long options starting with two dashes (`-'). A summary of
1291 -+ options is included below. For a complete description, see the
1292 -+ <application>Info</application> files.</para>
1293 -+
1294 -+ <variablelist>
1295 -+ <varlistentry>
1296 -+ <term><option>-h</option>
1297 -+ <option>--help</option>
1298 -+ </term>
1299 -+ <listitem>
1300 -+ <para>Show summary of options.</para>
1301 -+ </listitem>
1302 -+ </varlistentry>
1303 -+ <varlistentry>
1304 -+ <term><option>-v</option>
1305 -+ <option>--version</option>
1306 -+ </term>
1307 -+ <listitem>
1308 -+ <para>Show version of program.</para>
1309 -+ </listitem>
1310 -+ </varlistentry>
1311 -+ </variablelist>
1312 -+ </refsect1>
1313 -+ <refsect1>
1314 -+ <title>SEE ALSO</title>
1315 -+
1316 -+ <para>bar (1), baz (1).</para>
1317 -+
1318 -+ <para>The programs are documented fully by <citetitle>The Rise and
1319 -+ Fall of a Fooish Bar</citetitle> available via the
1320 -+ <application>Info</application> system.</para>
1321 -+ </refsect1>
1322 -+ <refsect1>
1323 -+ <title>AUTHOR</title>
1324 -+
1325 -+ <para>This manual page was written by &dhusername; &dhemail; for
1326 -+ the &debian; system (and may be used by others). Permission is
1327 -+ granted to copy, distribute and/or modify this document under
1328 -+ the terms of the &gnu; General Public License, Version 2 any
1329 -+ later version published by the Free Software Foundation.
1330 -+ </para>
1331 -+ <para>
1332 -+ On Debian systems, the complete text of the GNU General Public
1333 -+ License can be found in /usr/share/common-licenses/GPL.
1334 -+ </para>
1335 -+
1336 -+ </refsect1>
1337 -+</refentry>
1338 -+
1339 -+<!-- Keep this comment at the end of the file
1340 -+Local variables:
1341 -+mode: sgml
1342 -+sgml-omittag:t
1343 -+sgml-shorttag:t
1344 -+sgml-minimize-attributes:nil
1345 -+sgml-always-quote-attributes:t
1346 -+sgml-indent-step:2
1347 -+sgml-indent-data:t
1348 -+sgml-parent-document:nil
1349 -+sgml-default-dtd-file:nil
1350 -+sgml-exposed-tags:nil
1351 -+sgml-local-catalogs:nil
1352 -+sgml-local-ecat-files:nil
1353 -+End:
1354 -+-->
1355 -+++ varnish3-3.0.0/debian-test/preinst.ex
1356 -@@ -0,0 +1,35 @@
1357 -+#!/bin/sh
1358 -+# preinst script for varnish3
1359 -+#
1360 -+# see: dh_installdeb(1)
1361 -+
1362 -+set -e
1363 -+
1364 -+# summary of how this script can be called:
1365 -+# * <new-preinst> `install'
1366 -+# * <new-preinst> `install' <old-version>
1367 -+# * <new-preinst> `upgrade' <old-version>
1368 -+# * <old-preinst> `abort-upgrade' <new-version>
1369 -+# for details, see http://www.debian.org/doc/debian-policy/ or
1370 -+# the debian-policy package
1371 -+
1372 -+
1373 -+case "$1" in
1374 -+ install|upgrade)
1375 -+ ;;
1376 -+
1377 -+ abort-upgrade)
1378 -+ ;;
1379 -+
1380 -+ *)
1381 -+ echo "preinst called with unknown argument \`$1'" >&2
1382 -+ exit 1
1383 -+ ;;
1384 -+esac
1385 -+
1386 -+# dh_installdeb will replace this with shell code automatically
1387 -+# generated by other debhelper scripts.
1388 -+
1389 -+#DEBHELPER#
1390 -+
1391 -+exit 0
1392 -+++ varnish3-3.0.0/debian-test/dirs
1393 -@@ -0,0 +1,2 @@
1394 -+usr/bin
1395 -+usr/sbin
1396 -+++ varnish3-3.0.0/debian-test/varnish3.default.ex
1397 -@@ -0,0 +1,10 @@
1398 -+# Defaults for varnish3 initscript
1399 -+# sourced by /etc/init.d/varnish3
1400 -+# installed at /etc/default/varnish3 by the maintainer scripts
1401 -+
1402 -+#
1403 -+# This is a POSIX shell fragment
1404 -+#
1405 -+
1406 -+# Additional options that are passed to the Daemon.
1407 -+DAEMON_OPTS=""
1408 -+++ varnish3-3.0.0/debian-test/control
1409 -@@ -0,0 +1,18 @@
1410 -+Source: varnish3
1411 -+Section: unknown
1412 -+Priority: extra
1413 -+Maintainer: root <root@ragweed.knams.wikimedia.org>
1414 -+Build-Depends: dpatch, debhelper (>= 7), autotools-dev
1415 -+Standards-Version: 3.8.1
1416 -+Homepage: <insert the upstream URL, if relevant>
1417 -+
1418 -+Package: varnish3
1419 -+Architecture: any
1420 -+Depends: ${shlibs:Depends}, ${misc:Depends}
1421 -+Description: <insert up to 60 chars description>
1422 -+ <insert long description, indented with spaces>
1423 -+
1424 -+Package: varnish3-doc
1425 -+Architecture: all
1426 -+Description: documentation for varnish3
1427 -+ <insert long description, indented with spaces>
1428 -+++ varnish3-3.0.0/debian-test/compat
1429 -@@ -0,0 +1 @@
1430 -+7
1431 -+++ varnish3-3.0.0/debian-test/emacsen-startup.ex
1432 -@@ -0,0 +1,25 @@
1433 -+;; -*-emacs-lisp-*-
1434 -+;;
1435 -+;; Emacs startup file, e.g. /etc/emacs/site-start.d/50varnish3.el
1436 -+;; for the Debian varnish3 package
1437 -+;;
1438 -+;; Originally contributed by Nils Naumann <naumann@unileoben.ac.at>
1439 -+;; Modified by Dirk Eddelbuettel <edd@debian.org>
1440 -+;; Adapted for dh-make by Jim Van Zandt <jrv@debian.org>
1441 -+
1442 -+;; The varnish3 package follows the Debian/GNU Linux 'emacsen' policy and
1443 -+;; byte-compiles its elisp files for each 'emacs flavor' (emacs19,
1444 -+;; xemacs19, emacs20, xemacs20...). The compiled code is then
1445 -+;; installed in a subdirectory of the respective site-lisp directory.
1446 -+;; We have to add this to the load-path:
1447 -+(let ((package-dir (concat "/usr/share/"
1448 -+ (symbol-name flavor)
1449 -+ "/site-lisp/varnish3")))
1450 -+;; If package-dir does not exist, the varnish3 package must have
1451 -+;; removed but not purged, and we should skip the setup.
1452 -+ (when (file-directory-p package-dir)
1453 -+ (setq load-path (cons package-dir load-path))
1454 -+ (autoload 'varnish3-mode "varnish3-mode"
1455 -+ "Major mode for editing varnish3 files." t)
1456 -+ (add-to-list 'auto-mode-alist '("\\.varnish3$" . varnish3-mode))))
1457 -+
1458 -+++ varnish3-3.0.0/debian-test/init.d.ex
1459 -@@ -0,0 +1,157 @@
1460 -+#! /bin/sh
1461 -+#
1462 -+# skeleton example file to build /etc/init.d/ scripts.
1463 -+# This file should be used to construct scripts for /etc/init.d.
1464 -+#
1465 -+# Written by Miquel van Smoorenburg <miquels@cistron.nl>.
1466 -+# Modified for Debian
1467 -+# by Ian Murdock <imurdock@gnu.ai.mit.edu>.
1468 -+# Further changes by Javier Fernandez-Sanguino <jfs@debian.org>
1469 -+#
1470 -+# Version: @(#)skeleton 1.9 26-Feb-2001 miquels@cistron.nl
1471 -+#
1472 -+
1473 -+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
1474 -+DAEMON=/usr/sbin/varnish3
1475 -+NAME=varnish3
1476 -+DESC=varnish3
1477 -+
1478 -+test -x $DAEMON || exit 0
1479 -+
1480 -+LOGDIR=/var/log/varnish3
1481 -+PIDFILE=/var/run/$NAME.pid
1482 -+DODTIME=1 # Time to wait for the server to die, in seconds
1483 -+ # If this value is set too low you might not
1484 -+ # let some servers to die gracefully and
1485 -+ # 'restart' will not work
1486 -+
1487 -+# Include varnish3 defaults if available
1488 -+if [ -f /etc/default/varnish3 ] ; then
1489 -+ . /etc/default/varnish3
1490 -+fi
1491 -+
1492 -+set -e
1493 -+
1494 -+running_pid()
1495 -+{
1496 -+ # Check if a given process pid's cmdline matches a given name
1497 -+ pid=$1
1498 -+ name=$2
1499 -+ [ -z "$pid" ] && return 1
1500 -+ [ ! -d /proc/$pid ] && return 1
1501 -+ cmd=`cat /proc/$pid/cmdline | tr "\000" "\n"|head -n 1 |cut -d : -f 1`
1502 -+ # Is this the expected child?
1503 -+ [ "$cmd" != "$name" ] && return 1
1504 -+ return 0
1505 -+}
1506 -+
1507 -+running()
1508 -+{
1509 -+# Check if the process is running looking at /proc
1510 -+# (works for all users)
1511 -+
1512 -+ # No pidfile, probably no daemon present
1513 -+ [ ! -f "$PIDFILE" ] && return 1
1514 -+ # Obtain the pid and check it against the binary name
1515 -+ pid=`cat $PIDFILE`
1516 -+ running_pid $pid $DAEMON || return 1
1517 -+ return 0
1518 -+}
1519 -+
1520 -+force_stop() {
1521 -+# Forcefully kill the process
1522 -+ [ ! -f "$PIDFILE" ] && return
1523 -+ if running ; then
1524 -+ kill -15 $pid
1525 -+ # Is it really dead?
1526 -+ [ -n "$DODTIME" ] && sleep "$DODTIME"s
1527 -+ if running ; then
1528 -+ kill -9 $pid
1529 -+ [ -n "$DODTIME" ] && sleep "$DODTIME"s
1530 -+ if running ; then
1531 -+ echo "Cannot kill $LABEL (pid=$pid)!"
1532 -+ exit 1
1533 -+ fi
1534 -+ fi
1535 -+ fi
1536 -+ rm -f $PIDFILE
1537 -+ return 0
1538 -+}
1539 -+
1540 -+case "$1" in
1541 -+ start)
1542 -+ echo -n "Starting $DESC: "
1543 -+ start-stop-daemon --start --quiet --pidfile $PIDFILE \
1544 -+ --exec $DAEMON -- $DAEMON_OPTS
1545 -+ if running ; then
1546 -+ echo "$NAME."
1547 -+ else
1548 -+ echo " ERROR."
1549 -+ fi
1550 -+ ;;
1551 -+ stop)
1552 -+ echo -n "Stopping $DESC: "
1553 -+ start-stop-daemon --stop --quiet --pidfile $PIDFILE \
1554 -+ --exec $DAEMON
1555 -+ echo "$NAME."
1556 -+ ;;
1557 -+ force-stop)
1558 -+ echo -n "Forcefully stopping $DESC: "
1559 -+ force_stop
1560 -+ if ! running ; then
1561 -+ echo "$NAME."
1562 -+ else
1563 -+ echo " ERROR."
1564 -+ fi
1565 -+ ;;
1566 -+ #reload)
1567 -+ #
1568 -+ # If the daemon can reload its config files on the fly
1569 -+ # for example by sending it SIGHUP, do it here.
1570 -+ #
1571 -+ # If the daemon responds to changes in its config file
1572 -+ # directly anyway, make this a do-nothing entry.
1573 -+ #
1574 -+ # echo "Reloading $DESC configuration files."
1575 -+ # start-stop-daemon --stop --signal 1 --quiet --pidfile \
1576 -+ # /var/run/$NAME.pid --exec $DAEMON
1577 -+ #;;
1578 -+ force-reload)
1579 -+ #
1580 -+ # If the "reload" option is implemented, move the "force-reload"
1581 -+ # option to the "reload" entry above. If not, "force-reload" is
1582 -+ # just the same as "restart" except that it does nothing if the
1583 -+ # daemon isn't already running.
1584 -+ # check wether $DAEMON is running. If so, restart
1585 -+ start-stop-daemon --stop --test --quiet --pidfile \
1586 -+ /var/run/$NAME.pid --exec $DAEMON \
1587 -+ && $0 restart \
1588 -+ || exit 0
1589 -+ ;;
1590 -+ restart)
1591 -+ echo -n "Restarting $DESC: "
1592 -+ start-stop-daemon --stop --quiet --pidfile \
1593 -+ /var/run/$NAME.pid --exec $DAEMON
1594 -+ [ -n "$DODTIME" ] && sleep $DODTIME
1595 -+ start-stop-daemon --start --quiet --pidfile \
1596 -+ /var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
1597 -+ echo "$NAME."
1598 -+ ;;
1599 -+ status)
1600 -+ echo -n "$LABEL is "
1601 -+ if running ; then
1602 -+ echo "running"
1603 -+ else
1604 -+ echo " not running."
1605 -+ exit 1
1606 -+ fi
1607 -+ ;;
1608 -+ *)
1609 -+ N=/etc/init.d/$NAME
1610 -+ # echo "Usage: $N {start|stop|restart|reload|force-reload}" >&2
1611 -+ echo "Usage: $N {start|stop|restart|force-reload|status|force-stop}" >&2
1612 -+ exit 1
1613 -+ ;;
1614 -+esac
1615 -+
1616 -+exit 0
Index: trunk/debs/varnish3/debian/patches/series
@@ -1 +1 @@
2 -debian-changes-3.0.0-1wmf1
 2+debian-changes-3.0.0-1wmf6
Index: trunk/debs/varnish3/debian/patches/debian-changes-3.0.0-1wmf6
@@ -0,0 +1,61 @@
 2+--- varnish3-3.0.0.orig/bin/varnishncsa/varnishncsa.c
 3+@@ -85,7 +85,6 @@
 4+ #include <netdb.h>
 5+
 6+ static long int sequence_number = 0;
 7+-
 8+ static volatile sig_atomic_t reopen;
 9+
 10+ static struct logline {
 11+@@ -118,6 +117,8 @@ static int m_flag = 0;
 12+
 13+ static const char *format;
 14+
 15++struct hostent* h;
 16++
 17+ static int
 18+ isprefix(const char *str, const char *prefix, const char *end,
 19+ const char **next)
 20+@@ -568,8 +569,9 @@ h_ncsa(void *priv, enum VSL_tag_e tag, u
 21+ else
 22+ fprintf(fo, "%s", lp->df_h ? lp->df_h : "-");
 23+ break;
 24++
 25+ case 'l':
 26+- fprintf(fo, "-");
 27++ fprintf(fo, "%s", h->h_name);
 28+ break;
 29+
 30+ case 'm':
 31+@@ -783,8 +785,9 @@ main(int argc, char *argv[])
 32+ const char *P_arg = NULL;
 33+ const char *w_arg = NULL;
 34+ struct vpf_fh *pfh = NULL;
 35++ char hostname[1024];
 36+ FILE *of;
 37+- format = "%h %n %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
 38++ format = "%l %n %t %{Varnish:time_firstbyte}x %h %{Varnish:handling}x/%s %b %m http://%{Host}i%U%q - - %{Referer}i %{X-Forwarded-For}i %{User-agent}i";
 39+
 40+ vd = VSM_New();
 41+ VSL_Setup(vd);
 42+@@ -799,7 +802,7 @@ main(int argc, char *argv[])
 43+ fprintf(stderr, "-f and -F can not be combined\n");
 44+ exit(1);
 45+ }
 46+- format = "%{X-Forwarded-For}i %n %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
 47++ format = "%l %n %t %{Varnish:time_firstbyte}x %{X-Forwarded-For} %{Varnish:handling}x/%s %b %m http://%{Host}i%U%q - - %{Referer}i %{X-Forwarded-For}i %{User-agent}i";
 48+ format_flag = 1;
 49+ break;
 50+ case 'F':
 51+@@ -846,6 +849,10 @@ main(int argc, char *argv[])
 52+ }
 53+ }
 54+
 55++ hostname[1023] = '\0';
 56++ gethostname(hostname, 1023);
 57++ h = gethostbyname(hostname);
 58++
 59+ VSL_Arg(vd, 'c', optarg);
 60+
 61+ if (VSL_Open(vd, 1))
Index: trunk/debs/varnish3/debian/patches/01-varnishncsa-udp.dpatch
@@ -2,13 +2,13 @@
33 ## 01-varnishncsa-udp.dpatch by <root@ragweed.knams.wikimedia.org>
44 ##
55 ## All lines beginning with `## DP:' are a description of the patch.
6 -## DP: multicast udp logging w/seq numbering
 6+## DP: add server name to log output, format more like wmf squidlog
77
88 @DPATCH@
99
1010 --- varnish3-3.0.0~/bin/varnishncsa/varnishncsa.c 2011-08-09 23:55:17.000000000 +0000
11 -+++ varnish3-3.0.0/bin/varnishncsa/varnishncsa.c 2011-08-29 23:07:19.000000000 +0000
12 -@@ -79,6 +79,13 @@
 11+@@ -79,6 +79,12 @@
1312 #include "varnishapi.h"
1413 #include "base64.h"
1514
@@ -18,11 +18,19 @@
1919 +#include <netdb.h>
2020 +
2121 +static long int sequence_number = 0;
22 -+
2322 static volatile sig_atomic_t reopen;
2423
2524 static struct logline {
26 -@@ -533,6 +540,8 @@
 25+@@ -111,6 +117,8 @@
 26+
 27+ static const char *format;
 28+
 29++struct hostent* h;
 30++
 31+ static int
 32+ isprefix(const char *str, const char *prefix, const char *end,
 33+ const char **next)
 34+@@ -533,6 +541,8 @@
2735 /* We have a complete data set - log a line */
2836
2937 fo = priv;
@@ -31,7 +39,16 @@
3240
3341 for (p = format; *p != '\0'; p++) {
3442
35 -@@ -566,6 +575,10 @@
 43+@@ -559,13 +569,18 @@
 44+ else
 45+ fprintf(fo, "%s", lp->df_h ? lp->df_h : "-");
 46+ break;
 47++
 48+ case 'l':
 49+- fprintf(fo, "-");
 50++ fprintf(fo, "%s", h->h_name);
 51+ break;
 52+
3653 case 'm':
3754 fprintf(fo, "%s", lp->df_m);
3855 break;
@@ -42,7 +59,7 @@
4360
4461 case 'q':
4562 fprintf(fo, "%s", lp->df_q ? lp->df_q : "");
46 -@@ -594,7 +607,7 @@
 63+@@ -594,7 +609,7 @@
4764
4865 case 't':
4966 /* %t */
@@ -51,7 +68,7 @@
5269 fprintf(fo, "%s", tbuf);
5370 break;
5471
55 -@@ -695,12 +708,59 @@
 72+@@ -695,12 +710,59 @@
5673 open_log(const char *ofn, int append)
5774 {
5875 FILE *of;
@@ -81,9 +98,7 @@
8299 + }
83100 +
84101 + bzero((char *) &serv_addr, sizeof(serv_addr));
85 -
86 -- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) {
87 -- perror(ofn);
 102++
88103 + serv_addr.sin_family = AF_INET;
89104 + serv_addr.sin_port = htons(portno);
90105 + bcopy((char *)server->h_addr, (char *)&serv_addr.sin_addr.s_addr,
@@ -100,21 +115,23 @@
101116 +
102117 + if (connect(sockfd,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) {
103118 + perror("socket");
 119++ exit(1);
 120++ }
 121++
 122++ FILE *sf = fdopen(sockfd, "w");
 123+
 124+- if ((of = fopen(ofn, append ? "a" : "w")) == NULL) {
 125+- perror(ofn);
 126++ if (sf == NULL) {
104127 exit(1);
105128 }
106129 - return (of);
107130 +
108 -+ FILE *sf = fdopen(sockfd, "w");
109 -+
110 -+ if (sf == NULL) {
111 -+ exit(1);
112 -+ }
113 -+
114131 + return (sf);
115132 }
116133
117134 /*--------------------------------------------------------------------*/
118 -@@ -711,7 +771,7 @@
 135+@@ -711,7 +773,7 @@
119136
120137 fprintf(stderr,
121138 "usage: varnishncsa %s [-aDV] [-n varnish_name] "
@@ -123,21 +140,34 @@
124141 exit(1);
125142 }
126143
127 -@@ -724,7 +784,7 @@
 144+@@ -723,8 +785,9 @@
 145+ const char *P_arg = NULL;
128146 const char *w_arg = NULL;
129147 struct vpf_fh *pfh = NULL;
 148++ char hostname[1024];
130149 FILE *of;
131150 - format = "%h %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
132 -+ format = "%h %n %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
 151++ format = "%l %n %t %{Varnish:time_firstbyte}x %h %{Varnish:handling}x/%s %b %m http://%{Host}i%U%q - - %{Referer}i %{X-Forwarded-For}i %{User-agent}i";
133152
134153 vd = VSM_New();
135154 VSL_Setup(vd);
136 -@@ -739,7 +799,7 @@
 155+@@ -739,7 +802,7 @@
137156 fprintf(stderr, "-f and -F can not be combined\n");
138157 exit(1);
139158 }
140159 - format = "%{X-Forwarded-For}i %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
141 -+ format = "%{X-Forwarded-For}i %n %l %u %t \"%r\" %s %b \"%{Referer}i\" \"%{User-agent}i\"";
 160++ format = "%l %n %t %{Varnish:time_firstbyte}x %{X-Forwarded-For} %{Varnish:handling}x/%s %b %m http://%{Host}i%U%q - - %{Referer}i %{X-Forwarded-For}i %{User-agent}i";
142161 format_flag = 1;
143162 break;
144163 case 'F':
 164+@@ -786,6 +849,10 @@
 165+ }
 166+ }
 167+
 168++ hostname[1023] = '\0';
 169++ gethostname(hostname, 1023);
 170++ h = gethostbyname(hostname);
 171++
 172+ VSL_Arg(vd, 'c', optarg);
 173+
 174+ if (VSL_Open(vd, 1))

Status & tagging log