blob: d2ab3851643b83fc3d78d66bbb02dfc3817b236e [file] [log] [blame]
Filip Tehlar229f5fc2022-08-09 14:44:47 +00001package main
2
3import (
4 "fmt"
5 "io"
6 "net/http"
7 "os"
8)
9
10func main() {
adrianvillin28bd8f02024-02-13 06:00:02 -050011 if len(os.Args) < 3 {
Filip Tehlar229f5fc2022-08-09 14:44:47 +000012 fmt.Println("arg expected")
13 os.Exit(1)
14 }
15
adrianvillinfbf5f2b2024-02-13 03:26:25 -050016 http.HandleFunc("/httpTestFile", func(w http.ResponseWriter, r *http.Request) {
adrianvillin28bd8f02024-02-13 06:00:02 -050017 file, _ := os.Open("httpTestFile" + os.Args[2])
Filip Tehlar229f5fc2022-08-09 14:44:47 +000018 defer file.Close()
19 io.Copy(w, file)
20 })
21 err := http.ListenAndServe(os.Args[1], nil)
22 if err != nil {
23 fmt.Printf("%v\n", err)
24 os.Exit(1)
25 }
26}