@@ -27,14 +27,14 @@ func serveCommand(w io.Writer, cmdCtx commandContext) error {
2727 if ! cmdCtx .config .HasRemote (remoteName ) {
2828 resp .Header ().Set ("Content-Type" , "text/plain" )
2929 resp .WriteHeader (http .StatusNotFound )
30- resp .Write ([]byte ("remote not found" ))
30+ _ , _ = resp .Write ([]byte ("remote not found" ))
3131 return
3232 }
3333 remoteConfig , err := cmdCtx .config .GetRemote (remoteName )
3434 if err != nil {
3535 resp .Header ().Set ("Content-Type" , "text/plain" )
3636 resp .WriteHeader (http .StatusBadRequest )
37- resp .Write ([]byte (err .Error ()))
37+ _ , _ = resp .Write ([]byte (err .Error ()))
3838 return
3939 }
4040
@@ -47,7 +47,7 @@ func serveCommand(w io.Writer, cmdCtx commandContext) error {
4747 if err != nil {
4848 resp .Header ().Set ("Content-Type" , "text/plain" )
4949 resp .WriteHeader (http .StatusInternalServerError )
50- resp .Write ([]byte (err .Error ()))
50+ _ , _ = resp .Write ([]byte (err .Error ()))
5151 return
5252 }
5353
@@ -57,8 +57,8 @@ func serveCommand(w io.Writer, cmdCtx commandContext) error {
5757
5858 tar := remote .NewTar (resp )
5959 defer tar .Close ()
60- tar .SendFiles (afero .NewOsFs (), append (remoteConfig .SendFiles , remoteConfig .ConfigurationFile ))
61- tar .SendFile (constants .ManifestFilename , manifestData )
60+ _ = tar .SendFiles (afero .NewOsFs (), append (remoteConfig .SendFiles , remoteConfig .ConfigurationFile ))
61+ _ = tar .SendFile (constants .ManifestFilename , manifestData )
6262
6363 })
6464
@@ -67,8 +67,9 @@ func serveCommand(w io.Writer, cmdCtx commandContext) error {
6767 defer signal .Stop (quit )
6868
6969 server := & http.Server {
70- Addr : fmt .Sprintf ("localhost:%s" , cmdCtx .flags .resticArgs [1 ]),
71- Handler : handler ,
70+ Addr : fmt .Sprintf ("localhost:%s" , cmdCtx .flags .resticArgs [1 ]),
71+ Handler : handler ,
72+ ReadHeaderTimeout : 5 * time .Second ,
7273 }
7374
7475 // put the shutdown code in a goroutine
0 commit comments