From 79e582819b55748d2ba628081af4dab2b55348ad Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 2 May 2017 13:07:50 -0700 Subject: [PATCH 1/2] protocol: sort xml attributes A cosmetic change, though this will change the order in the XML output. The spec lists fields alphabetically so this makes comparison easier. --- omaha/protocol.go | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/omaha/protocol.go b/omaha/protocol.go index b3ec12d..e9f2248 100644 --- a/omaha/protocol.go +++ b/omaha/protocol.go @@ -32,13 +32,13 @@ type Request struct { OS *OS `xml:"os"` Apps []*AppRequest `xml:"app"` Protocol string `xml:"protocol,attr"` - Version string `xml:"version,attr,omitempty"` + InstallSource string `xml:"installsource,attr,omitempty"` IsMachine string `xml:"ismachine,attr,omitempty"` RequestId string `xml:"requestid,attr,omitempty"` SessionId string `xml:"sessionid,attr,omitempty"` - UserId string `xml:"userid,attr,omitempty"` - InstallSource string `xml:"installsource,attr,omitempty"` TestSource string `xml:"testsource,attr,omitempty"` + UserId string `xml:"userid,attr,omitempty"` + Version string `xml:"version,attr,omitempty"` // update engine extension, duplicates the version attribute. UpdaterVersion string `xml:"updaterversion,attr,omitempty"` @@ -67,24 +67,24 @@ type AppRequest struct { UpdateCheck *UpdateRequest `xml:"updatecheck"` Events []*EventRequest `xml:"event" json:",omitempty"` Id string `xml:"appid,attr,omitempty"` - Version string `xml:"version,attr,omitempty"` - NextVersion string `xml:"nextversion,attr,omitempty"` - Lang string `xml:"lang,attr,omitempty"` Client string `xml:"client,attr,omitempty"` InstallAge string `xml:"installage,attr,omitempty"` + Lang string `xml:"lang,attr,omitempty"` + NextVersion string `xml:"nextversion,attr,omitempty"` + Version string `xml:"version,attr,omitempty"` // update engine extensions - Track string `xml:"track,attr,omitempty"` - FromTrack string `xml:"from_track,attr,omitempty"` Board string `xml:"board,attr,omitempty"` DeltaOK bool `xml:"delta_okay,attr,omitempty"` + FromTrack string `xml:"from_track,attr,omitempty"` + Track string `xml:"track,attr,omitempty"` // coreos update engine extensions + AlephVersion string `xml:"alephversion,attr,omitempty"` BootId string `xml:"bootid,attr,omitempty"` MachineID string `xml:"machineid,attr,omitempty"` OEM string `xml:"oem,attr,omitempty"` OEMVersion string `xml:"oemversion,attr,omitempty"` - AlephVersion string `xml:"alephversion,attr,omitempty"` } func (a *AppRequest) AddUpdateCheck() *UpdateRequest { @@ -116,9 +116,9 @@ type PingRequest struct { type EventRequest struct { Type EventType `xml:"eventtype,attr"` Result EventResult `xml:"eventresult,attr"` + ErrorCode string `xml:"errorcode,attr,omitempty"` NextVersion string `xml:"nextversion,attr,omitempty"` PreviousVersion string `xml:"previousversion,attr,omitempty"` - ErrorCode string `xml:"errorcode,attr,omitempty"` } // Response sent by the Omaha server From 5f9a499a462fcf03bbaabff960bab06180cceff1 Mon Sep 17 00:00:00 2001 From: Michael Marineau Date: Tue, 2 May 2017 13:15:04 -0700 Subject: [PATCH 2/2] package: fix SHA256 attribute name, now defined by the spec. The old name was my own extension and unused by anything so there aren't any compatibility issues here. --- omaha/package.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/omaha/package.go b/omaha/package.go index 497d239..d2dcdc6 100644 --- a/omaha/package.go +++ b/omaha/package.go @@ -29,12 +29,11 @@ var ( PackageSizeMismatchError = errors.New("package size is invalid") ) -// Package represents a single downloadable file. The Sha256 attribute -// is not a standard part of the Omaha protocol which only uses Sha1. +// Package represents a single downloadable file. type Package struct { Name string `xml:"name,attr"` Sha1 string `xml:"hash,attr"` - Sha256 string `xml:"sha256,attr,omitempty"` + Sha256 string `xml:"hash_sha256,attr,omitempty"` Size uint64 `xml:"size,attr"` Required bool `xml:"required,attr"` }