| 99 | } |
| 100 | |
| 101 | func getURLInfo(ctx context.Context, warPath string) (io.ReadCloser, int64, error) { |
| 102 | res, err := http.Get(warPath) |
| 103 | if err != nil { |
| 104 | return nil, 0, errors.Wrapf(ctx, err, "get WAR file") |
| 105 | } |
| 106 | |
| 107 | warSize := int64(0) |
| 108 | warReadStream := res.Body |
| 109 | if res.Header.Get("Content-Length") != "" { |
| 110 | i, err := strconv.ParseInt(res.Header.Get("Content-Length"), 10, 64) |
| 111 | if err == nil { |
| 112 | // If there is an error, we just skip this header |
| 113 | warSize = i |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | return warReadStream, warSize, nil |
| 118 | } |
| 119 | |
| 120 | func getFileInfo(ctx context.Context, warPath string) (io.ReadCloser, int64, string, error) { |
| 121 | warSize := int64(0) |