Package: netcat-openbsd
Version: 1.89-4
Severity: normal
It seems that the behavior of the -q flag for netcat-openbsd is the
exact opposite of the behavior for the same flag in netcat-traditional, despite
the documentation being the same. Here's the documentation:
0 d...@pip:~$ man nc_traditional | grep -A1 ' -q'
-q seconds after EOF on stdin, wait the specified number of seconds
and then quit. If seconds is negative, wait forever.
0 d...@pip:~$ man nc_openbsd | grep -A1 ' -q'
-q after EOF on stdin, wait the specified number of seconds and then
quit. If seconds is negative, wait forever.
0 d...@pip:~$
Look at the timeouts for these connections (/usr/bin/ts is from the
moreutils package):
0 d...@pip:~$ time printf 'GET / HTTP/1.1\nHost: nytimes.com\n\n' | nc.openbsd
-q10 nytimes.com 80 | ts '%H:%M:%.S'
20:27:38.205106 HTTP/1.1 301 Moved Permanently
20:27:38.205425 Server: Sun-ONE-Web-Server/6.1
20:27:38.205489 Date: Mon, 13 Dec 2010 01:27:38 GMT
20:27:38.205541 Content-length: 122
20:27:38.205590 Content-type: text/html
20:27:38.205639 Location: http://www.nytimes.com/
20:27:38.205688 nnCoection: close
20:27:38.205736
20:27:38.205784 <HTML><HEAD><TITLE>Moved Permanently</TITLE></HEAD>
20:27:38.205834 <BODY><H1>Moved Permanently</H1>
20:27:38.205883 An error has occurred.
20:27:48.105500 </BODY></HTML>
real 0m10.103s
user 0m0.088s
sys 0m0.008s
0 d...@pip:~$ time printf 'GET / HTTP/1.1\nHost: nytimes.com\n\n' | nc.openbsd
nytimes.com 80 | ts '%H:%M:%.S'
20:27:53.522015 HTTP/1.1 301 Moved Permanently
20:27:53.522315 Server: Sun-ONE-Web-Server/6.1
20:27:53.522376 Date: Mon, 13 Dec 2010 01:27:53 GMT
20:27:53.522426 Content-length: 122
20:27:53.522474 Content-type: text/html
20:27:53.522521 Location: http://www.nytimes.com/
20:27:53.522570 Connection: close
20:27:53.522617
20:27:53.522665 <HTML><HEAD><TITLE>Moved Permanently</TITLE></HEAD>
20:27:53.522714 <BODY><H1>Moved Permanently</H1>
20:27:53.522763 An error has occurred.
20:27:53.553898 </BODY></HTML>
real 0m0.135s
user 0m0.088s
sys 0m0.004s
0 d...@pip:~$ time printf 'GET / HTTP/1.1\nHost: nytimes.com\n\n' |
nc.traditional -q10 nytimes.com 80 | ts '%H:%M:%.S'
20:28:00.222656 HTTP/1.1 301 Moved Permanently
20:28:00.222931 Server: Sun-ONE-Web-Server/6.1
20:28:00.222994 Date: Mon, 13 Dec 2010 01:28:00 GMT
20:28:00.223048 Content-length: 122
20:28:00.223098 Content-type: text/html
20:28:00.223150 Location: http://www.nytimes.com/
20:28:00.223201 nnCoection: close
20:28:00.223252
20:28:00.223303 <HTML><HEAD><TITLE>Moved Permanently</TITLE></HEAD>
20:28:00.223355 <BODY><H1>Moved Permanently</H1>
20:28:00.223406 An error has occurred.
20:28:00.479129 </BODY></HTML>
real 0m0.361s
user 0m0.088s
sys 0m0.004s
0 d...@pip:~$ time printf 'GET / HTTP/1.1\nHost: nytimes.com\n\n' |
nc.traditional nytimes.com 80 | ts '%H:%M:%.S'
20:28:05.244744 HTTP/1.1 301 Moved Permanently
20:28:05.245017 Server: Sun-ONE-Web-Server/6.1
20:28:05.245080 Date: Mon, 13 Dec 2010 01:28:05 GMT
20:28:05.245130 Content-length: 122
20:28:05.245178 Content-type: text/html
20:28:05.245225 Location: http://www.nytimes.com/
20:28:05.245273 nnCoection: close
20:28:05.245320
20:28:05.245367 <HTML><HEAD><TITLE>Moved Permanently</TITLE></HEAD>
20:28:05.245416 <BODY><H1>Moved Permanently</H1>
20:28:05.245464 An error has occurred.
20:33:20.109584 </BODY></HTML>
real 5m14.963s
user 0m0.080s
sys 0m0.008s
0 d...@pip:~$
Thanks for netcat. it's a very useful tool.
Regards,
--dkg
PS i have netcat-traditional 1.10-38 installed. feel free to reassign
this bug to that package if you think the bug is over there.
hopefully these two implementations can come to some consensus over
the proper behavior of the arguments.
-- System Information:
Debian Release: squeeze/sid
APT prefers testing
APT policy: (500, 'testing'), (200, 'unstable'), (1, 'experimental')
Architecture: i386 (i686)
Kernel: Linux 2.6.36-trunk-686 (SMP w/1 CPU core)
Locale: LANG=en_US.utf8, LC_CTYPE=en_US.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash
Versions of packages netcat-openbsd depends on:
ii libc6 2.11.2-7 Embedded GNU C Library: Shared lib
ii libglib2.0-0 2.24.2-1 The GLib library of C routines
netcat-openbsd recommends no packages.
netcat-openbsd suggests no packages.
-- no debconf information
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]