This adds the --crlf option to netcat, which triggers translation of \n characters into \r\n sequences in the input -> network direction.
The Linux version of nc also supports this functionality with --crlf and -C. The OpenBSD version uses -C to specify client certificates. Our version is too old and doesn't have it, but I avoided adding -C anyway to ease future syncs with upstream.
Details
Details
- Reviewers
cognet markj delphij - Commits
- rGd4b3aefdf94f: netcat: add --crlf to convert LF into CRLF
An interactive session with nginx suffices to test that --crlf allows you to trigger an HTTP Response.
Diff Detail
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
contrib/netcat/netcat.c | ||
---|---|---|
174 | These should be alphabetically sorted. | |
986 | Suppose there is some data after a LF. Now, if --crlf is specified, we do not write it right away. It looks like we'll poll() and immediately try again, so this is not a problem. Am I understanding correctly? | |
1059 | ||
1062 | If the input starts with a LF, we won't add the CR, is that right? |
contrib/netcat/netcat.c | ||
---|---|---|
1062 | Sorry, I had misread. |
Comment Actions
LGTM (note that since this is OS independent it's probably worth a try to upstream it and avoid divergence from OpenBSD)