diff options
author | tjpcc <tjp@ctrl-c.club> | 2023-11-01 16:17:41 -0600 |
---|---|---|
committer | tjpcc <tjp@ctrl-c.club> | 2023-11-01 16:17:41 -0600 |
commit | a808b4692656c10bb43e2d54a2f5ef2746d231d5 (patch) | |
tree | 6e432d4a0271bb080451e3c87cffa6831c5736cd /tools/sw-fetch/main.go | |
parent | 5be7e44150d31582e6d8577d48c842a421fa8ddc (diff) |
allow titan uploads in the meta-client
fixes #18
Diffstat (limited to 'tools/sw-fetch/main.go')
-rw-r--r-- | tools/sw-fetch/main.go | 19 |
1 files changed, 1 insertions, 18 deletions
diff --git a/tools/sw-fetch/main.go b/tools/sw-fetch/main.go index 8591fe2..c2cb3e8 100644 --- a/tools/sw-fetch/main.go +++ b/tools/sw-fetch/main.go @@ -1,7 +1,6 @@ package main import ( - "bytes" "crypto/tls" "fmt" "io" @@ -38,12 +37,7 @@ func main() { var err error if conf.upload { - body, er := stdinContents() - if er != nil { - err = er - } else { - response, err = cl.Upload(conf.url.String(), body) - } + response, err = cl.Upload(conf.url.String(), os.Stdin) } else { response, err = cl.Fetch(conf.url.String()) } @@ -155,17 +149,6 @@ func failf(msg string, args ...any) { os.Exit(1) } -func stdinContents() (*io.LimitedReader, error) { - contents, err := io.ReadAll(os.Stdin) - if err != nil { - return nil, err - } - return &io.LimitedReader{ - R: bytes.NewBuffer(contents), - N: int64(len(contents)), - }, nil -} - func printResponse(response *sliderule.Response, conf config) bool { success := true |