Making HTTP requests without crates

Anybody have a recommendation on how to make HTTP requests without crates? Which resources should I document me with to be able to build that? I have no idea where to start investigating

I’d start by looking into the http crate to see how they did it.

Why do you want to do this?

Http 1.1 without tls is a plain text protocol so you can write strings on tcp socket. As you don’t want to use external crate for it(maybe for learning purpose?), there’s virtually nothing Rust specific here. There’s a bunch of examples on the internet to make http request/response over telnet, which essentially is a cli wrapper over tcp connection.

1 Like

Rather tangential, but a telnet client isn’t for transmitting arbitrary data over a TCP connection, it only speaks the Telnet protocol. There some octets are interpreted as command sequences and the client mandates \r\n as line endings. The client may also end up interpreting server-side data as commands and distort the data or the terminal.

If your intent is to teach how to hand-craft a HTTP/1.1 connection, netcat would be a better choice as it’s designed for direct interaction over sockets.


This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.