[mirror] Command-line application for uploading a site to a git-pages server

Make HTTP request bodies rewindable for redirects.

authored by

miyuko and committed by whitequark.org 974d6720 ab5cefab

+3 -3
+3 -3
main.go
··· 295 295 } 296 296 } 297 297 298 + requestBody := streamArchiveFS(uploadDir.FS(), pathPrefix, []string{}) 298 299 if *pathFlag == "" { 299 - request, err = http.NewRequest("PUT", siteURL.String(), nil) 300 + request, err = http.NewRequest("PUT", siteURL.String(), requestBody) 300 301 } else { 301 - request, err = http.NewRequest("PATCH", siteURL.String(), nil) 302 + request, err = http.NewRequest("PATCH", siteURL.String(), requestBody) 302 303 } 303 304 if err != nil { 304 305 fmt.Fprintf(os.Stderr, "error: %s\n", err) 305 306 os.Exit(1) 306 307 } 307 - request.Body = streamArchiveFS(uploadDir.FS(), pathPrefix, []string{}) 308 308 request.ContentLength = -1 309 309 request.Header.Add("Content-Type", "application/x-tar+zstd") 310 310 request.Header.Add("Accept", "application/vnd.git-pages.unresolved;q=1.0, text/plain;q=0.9")