Urgent.News

One page, thousands of outlets. See who else covered it.

Editions

Tech

Send an HTTP Request by Hand With Netcat

Type a raw HTTP request into a TCP socket, read back a real 200 OK , then watch one wrong character kill it. No browser, no library. Prerequisites A Linux terminal (any distro; a VM is fine) bash or zsh Internet access Steps 1. Check for netcat and identify the variant. which nc && nc -h 2>&1 | head -1 Expect: a path such as /usr/bin/nc , then a line naming the build — OpenBSD netcat or Ncat 7.xx…

To send an HTTP request using netcat, first verify if netcat is installed and identify the version. If it's not installed, install the appropriate package for your Linux distribution. Next, confirm that port 80 is reachable by running a test with netcat. Store the HTTP request in a variable, ensuring to use single quotes to prevent shell variable expansion.

Send the request using printf and pipe it to netcat, which will connect to the specified host and port. The output will include a status line, headers, and the response body. Read the status line to confirm a successful request (HTTP/1.1 200 OK). Examine the headers for additional information, such as Content-Length or Transfer-Encoding.

To view the entire response, use the less command. If the response is chunked, locate the first line after the headers. Finally, analyze the end of the response, which should contain a single 0 followed by a carriage return. If the request is intentionally malformed, no output will be displayed.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

mobx-react-form is now mobx-formkit

The mobx-react-form package — after 273 releases ending with 7.1.0 — is now published on npm as mobx-formkit . The old package name is marked as deprecated on the npm registry: anyone installing…

More from Sunday 16 August →