upload/koji/uploadChunk: fix compilation errors
The API of kolo/xmlrpc changed after the commit that is shipped in Fedora. Pin the vendored version to that and adjust the API usage. This should make the RPM compile in both RHEL and Fedora. Signed-off-by: Tom Gundersen <teg@jklm.no>
This commit is contained in:
parent
3457038688
commit
b6f06da1a7
10 changed files with 93 additions and 59 deletions
|
|
@ -305,20 +305,20 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
|
|||
u.RawQuery = q.Encode()
|
||||
|
||||
client := http.Client{Transport: k.transport}
|
||||
resp, err := client.Post(u.String(), "application/octet-stream", bytes.NewBuffer(chunk))
|
||||
respData, err := client.Post(u.String(), "application/octet-stream", bytes.NewBuffer(chunk))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
defer respData.Body.Close()
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
body, err := ioutil.ReadAll(respData.Body)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
err = xmlrpc.Response.Err(body)
|
||||
if err != nil {
|
||||
return err
|
||||
resp := xmlrpc.NewResponse(body)
|
||||
if resp.Failed() {
|
||||
return resp.Err()
|
||||
}
|
||||
|
||||
var reply struct {
|
||||
|
|
@ -326,7 +326,7 @@ func (k *Koji) uploadChunk(chunk []byte, filepath, filename string, offset uint6
|
|||
HexDigest string `xmlrpc:"hexdigest"`
|
||||
}
|
||||
|
||||
err = xmlrpc.Response.Unmarshal(body, &reply)
|
||||
err = resp.Unmarshal(&reply)
|
||||
if err != nil {
|
||||
return fmt.Errorf("cannot unmarshal the xmlrpc response: %v", err)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue