Serve data straight from STDIN
Find a file
2023-12-19 00:49:35 +03:00
.github/workflows CI: build with Go 2023-12-19 00:40:33 +03:00
.gitignore Initial commit 2023-12-19 00:38:54 +03:00
go.mod Initial commit 2023-12-19 00:38:54 +03:00
LICENSE Initial commit 2023-12-19 00:38:54 +03:00
main.go feat: basic authentication 2023-12-19 00:49:35 +03:00
README.md feat: basic authentication 2023-12-19 00:49:35 +03:00

🌐 httpserve

A simple HTTP server written in Go that reads data from standard input (stdin) and serves it over HTTP. It allows users to transmit data through HTTP requests by piping data into the server via stdin.

Usage

httpserve -p <PORT> -a <ADDRESS> -f <FILENAME> -c <CONTENT_TYPE>

Options

  • -p <PORT>: Set the port for the server (default: 8080)
  • -a <ADDRESS>: Set the address for the server (default: 0.0.0.0)
  • -f <FILENAME>: Set the filename header for downloaded content
  • -c <CONTENT_TYPE>: Set the content-type header (default: application/octet-stream)
  • -user <USERNAME>: The user that will be used in authentication prompts
  • -password <PASSWORD>: The password required to access served data

Examples

  1. Accessing served data without filename or content type
curl http://localhost:8080

Retrieves the served data from the default address, which is http://localhost:8080.

  1. Downloading served data with specified filename and content type
curl -o output.txt -H "Content-Type: text/plain" http://localhost:8080
  • -o output.txt: Saves the served data to a file named output.txt.
  • -H "Content-Type: text/plain": Specifies the content type of the requested data.

Why?

Honestly, why not. Httpserve is designed to receive data from standard input and serve it over HTTP, offering a pretty simple and flexible method for sharing and transmitting data across network endpoints.