[Pkg-cups-devel] Bug#504727: cups doesn't honour the "Connection: Close" HTTP client header

Stephane Chazelas stephane at artesyncp.com
Thu Nov 6 16:59:09 UTC 2008


Package: cups
Version: 1.3.8-1lenny2
Severity: normal


Below is a wireshark capture of a client (nagios) doing an HTTP
request to cups. The client uses HTTP 1.1 and includes the
"Connection: close" header meaning that he wants that request to
be the last one. cups replies with a "Connection: keep-alive"
header and doesn't close its end of the connection, which is in
violation of the HTTP 1.1 RFC.

In the case of nagios, it has the effect of nagios timing out
after 10 seconds waiting for the connection to close, and thus
declares the cups service dead.

This is on the loopback interface, so no proxy comes into play.

Request from nagios:

[...]
Frame 4 (180 bytes on wire, 180 bytes captured)
    Arrival Time: Nov  6, 2008 16:25:37.127285000
[...]
Hypertext Transfer Protocol
    GET / HTTP/1.1\r\n
        Request Method: GET
        Request URI: /
        Request Version: HTTP/1.1
    Host: 127.0.0.1:631\r\n
    User-Agent: check_http/v1991 (nagios-plugins 1.4.12)\r\n
    Connection: close\r\n
    \r\n
[...]

answer from cups:

Frame 6 (323 bytes on wire, 323 bytes captured)
    Arrival Time: Nov  6, 2008 16:25:37.127445000
    [Time delta from previous captured frame: 0.000151000 seconds]
    [Time delta from previous displayed frame: 0.000151000 seconds]
    [Time since reference or first frame: 0.000405000 seconds]
[...]
Hypertext Transfer Protocol
    HTTP/1.1 200 OK\r\n
        Request Version: HTTP/1.1
        Response Code: 200
    Date: Thu, 06 Nov 2008 16:25:37 GMT\r\n
    Server: CUPS/1.3\r\n
    Connection: Keep-Alive\r\n
    Keep-Alive: timeout=60\r\n
    Content-Language: en_GB\r\n
    Content-Type: text/html; charset=utf-8\r\n
    Last-Modified: Sat, 11 Oct 2008 10:58:14 GMT\r\n
    Content-Length: 5242
    \r\n

[...]

After 10 seconds, nagios times out.

Frame 10 (68 bytes on wire, 68 bytes captured)
    Arrival Time: Nov  6, 2008 16:25:47.127182000
    [Time delta from previous captured frame: 9.999571000 seconds]
    [Time delta from previous displayed frame: 9.999571000 seconds]
    [Time since reference or first frame: 10.000142000 seconds]
[...]
Transmission Control Protocol, Src Port: 41750 (41750), Dst Port: ipp (631), Seq: 113, Ack: 5498, Len: 0
    Source port: 41750 (41750)
    Destination port: ipp (631)
    Sequence number: 113    (relative sequence number)
    Acknowledgement number: 5498    (relative ack number)
    Header length: 32 bytes
    Flags: 0x11 (FIN, ACK)

[...]

nagios log:

CURRENT SERVICE STATE: localhost;CUPS;CRITICAL;HARD;4;CRITICAL -
Socket timeout after 10 seconds

The "CUPS" nagios service does a:
/usr/lib/nagios/plugins/check_http -H localhost -p 631

Which does:

socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(631),
sin_addr=inet_addr("127.0.0.1")}, 16) = 0
send(3, "GET / HTTP/1.1\r\nHost: localhost:6"..., 112, 0) = 112
read(3, "HTTP/1.1 200 OK\r\nDate: Thu, 06 No"..., 8191) = 5497
read(3,

That second read is waiting for end of file that never comes
(well would come after cups keep-alive timeout: 1 minute) and
so times out.

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (990, 'unstable'), (50, 'experimental')
Architecture: i386 (i686)

Kernel: Linux 2.6.24.2
Locale: LANG=en_GB.ISO-8859-15, LC_CTYPE=en_GB.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages cups depends on:
ii  adduser               3.110              add and remove users and groups
ii  cups-common           1.3.8-1lenny2      Common UNIX Printing System(tm) - 
ii  debconf [debconf-2.0] 1.5.24             Debian configuration management sy
ii  ghostscript           8.62.dfsg.1-3.1    The GPL Ghostscript PostScript/PDF
ii  libavahi-compat-libdn 0.6.23-2           Avahi Apple Bonjour compatibility 
ii  libc6                 2.7-15             GNU C Library: Shared libraries
ii  libcups2              1.3.8-1lenny2      Common UNIX Printing System(tm) - 
ii  libcupsimage2         1.3.8-1lenny2      Common UNIX Printing System(tm) - 
ii  libdbus-1-3           1.2.1-4            simple interprocess messaging syst
ii  libgnutls26           2.4.2-1            the GNU TLS library - runtime libr
ii  libkrb53              1.6.dfsg.4~beta1-4 MIT Kerberos runtime libraries
ii  libldap-2.4-2         2.4.11-1           OpenLDAP libraries
ii  libpam0g              1.0.1-4            Pluggable Authentication Modules l
ii  libpaper1             1.1.23+nmu1        library for handling paper charact
ii  libslp1               1.2.1-7.4          OpenSLP libraries
ii  lsb-base              3.2-20             Linux Standard Base 3.2 init scrip
ii  perl-modules          5.10.0-16          Core Perl modules
ii  poppler-utils [xpdf-u 0.8.7-1            PDF utilitites (based on libpopple
ii  procps                1:3.2.7-9          /proc file system utilities
ii  ssl-cert              1.0.23             simple debconf wrapper for OpenSSL

Versions of packages cups recommends:
ii  avahi-utils           0.6.23-2           Avahi browsing, publishing and dis
ii  cups-client           1.3.8-1lenny2      Common UNIX Printing System(tm) - 
ii  foomatic-filters      3.0.2-20080211-3.2 OpenPrinting printer support - fil
ii  smbclient             2:3.2.4-1          a LanManager-like simple client fo

Versions of packages cups suggests:
ii  cups-bsd                1.3.8-1lenny2    Common UNIX Printing System(tm) - 
pn  cups-driver-gutenprint  <none>           (no description available)
pn  cups-pdf                <none>           (no description available)
ii  foomatic-db             20080211-2+nmu1  OpenPrinting printer support - dat
ii  foomatic-db-engine      3.0.2-20080211-1 OpenPrinting printer support - pro
pn  hplip                   <none>           (no description available)
pn  xpdf-korean | xpdf-japa <none>           (no description available)

-- debconf information:
  cupsys/raw-print: true
  cupsys/backend: ipp, lpd, parallel, scsi, serial, socket, usb, snmp, dnssd





More information about the Pkg-cups-devel mailing list