On Aug 24 2023, 01:02 UTC, Damien Miller <d...@mindrot.org> wrote:
On Wed, 23 Aug 2023, Pietro Cerutti wrote:

Hi,

here at FreeBSD, we vendor in your netcat with a few local modifications.

I'm working on adding support to --crlf. I have a diff against the FreeBSD
version here: https://reviews.freebsd.org/D41489

I'd like this to be upstreamed. If there's consensus, I'll prepare a patch
against OpenBSD's version and send it over.

What is the motivation for this option beyond "Linux has it"?

The motivation is that several network protocols are line oriented with CRLF as line terminators. SMTP and HTTP are among the most popular.
I don't come from Linux so "Linux has it" was not among my motivations.

Correct me if I'm wrong but it seems trivial to do this conversion without writing more code by sticking tr in a pipe with nc.

Can you please provide an example? I can't see how to make tr convert LFs not preceeded by CRs to CRLFs.

OpenBSD's nc doesn't use getopt_long at present and I'm not sure there
would be appetite to do it for a single new flag. I note that nc on the
Debian machine I have at hand does -C but doesn't recognise --crlf.
IMO the long option therefore just adds incompatibility.

That's a fair point - I should have noticed that. If you want the feature, we can pick a new short option and I'm happy to make the FreeBSD version compatible with that.


[djm@dvm ~]$ nc --crlf
nc: invalid option -- '-'
usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl]
         [-m minttl] [-O length] [-P proxy_username] [-p source_port]
         [-q seconds] [-s sourceaddr] [-T keyword] [-V rtable] [-W recvlimit]
         [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]]
         [destination] [port]
[djm@dvm ~]$ uname -a
Linux dvm 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.38-1 (2023-07-14) 
x86_64 GNU/Linux

FWIW, it works on RHEL 7.9

--
Pietro Cerutti
I have pledged to give 10% of income to effective charities
and invite you to join me - https://givingwhatwecan.org

Reply via email to