Update Protocol

This section provides information about the the update protocol.

The agent (launcher) is responsible for updates. It basically queries components over HTTP and, if required, downloads them. It is very similar to SC2's agent.

Diablo 3 Update Process
[agent->bnet2] -- POST /patch HTTP/1.1 Content-Type: text/html Content-Length: 140 User-Agent: Blizzard Web Client Host: enUS.patch.battle.net:1119 Cache-Control: no-cache Cookie: __utma=134253166.570439164.1309041696.1309217021.1309302496.6; __utmz=134253166.1309041696.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)   

[bnet2->agent] -- HTTP/1.1 200 OK  Server: Protocol HTTP Content-Length: 535 Connection: close Content-Type: application/xml http://attdist.blizzard.com/sc2patch/update/B16117-5C52FCF1/sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;69B17A0F007E49F5B37E2876C87A17DA;22280 http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/Patches/agent404/agent-403-404-win.mpq.torrent;http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/Patches/agent404/agent-404-win.mpq.torrent;404;403;0

[agent->bnet2] -- POST /patch HTTP/1.1 Content-Type: text/html Content-Length: 140 User-Agent: Blizzard Web Client Host: enUS.patch.battle.net:1119 Cache-Control: no-cacheCookie: __utma=134253166.570439164.1309041696.1309217021.1309302496.6; __utmz=134253166.1309041696.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)   

[bnet2->agent] -- HTTP/1.1 200 OK  Server: Protocol HTTP Content-Length: 535 Connection: close Content-Type: application/xml http://attdist.blizzard.com/sc2patch/update/B16117-5C52FCF1/sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;69B17A0F007E49F5B37E2876C87A17DA;22280 http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/Patches/bl525/launcher-524-525-win.mpq.torrent;http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/Patches/bl525/launcher-525-win.mpq.torrent;525;524;0

[agent->bnet2] -- POST /patch HTTP/1.1 Content-Type: text/html Content-Length: 137 User-Agent: Blizzard Web Client Host: enUS.patch.battle.net:1119Cache-Control: no-cacheCookie: __utma=134253166.570439164.1309041696.1309217021.1309302496.6; __utmz=134253166.1309041696.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)   

[bnet2->agent] -- HTTP/1.1 200 OK  Server: Protocol HTTP Content-Length: 487 Connection: close Content-Type: application/xml http://attdist.blizzard.com/sc2patch/update/B16117-5C52FCF1/sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;sc2-1-22280-x86-Win-enUS-bnet-bin-component-dl;69B17A0F007E49F5B37E2876C87A17DA;22280 http://ak.worldofwarcraft.com.edgesuite.net/d3-pod/20FB5BE9/NA/d3-7318-A25A9969D948E82419928FBFBACA41A3.xml;D253D8118D6D5D4A50A5DE72526D8AA1;A0F73AD55B049A9A6B3D94D7B944F07E;7318

First Step
The client sends POST request to us-beta.patch.battle.net:1120 with the following XML data:

 <record program="SC2" component="Win" version="[...Version number...]" /> <record program="SC2" component="enUS" version="[...Version number...]" /> <record program="Bnet" component="base" version="[...Version number...]" /> <record program="Bnet" component="Win" version="[...Version number...]" /> <record program="Tool" component="Win" version="[...Version number...]" />

Second Step
If the server detects we have the lastest version it sends 204 (No Content) as said in the first post. If we need an update the server sends:

HTTP/1.1 200 OK Server: Protocol HTTP Content-Length: 1118 Connection: close Content-Type: application/xml <record program="SC2" component="Win">http://dist.blizzard.com.edgesuite.net/sc2patch/update/B14093B/sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-game-component-dl;sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-game-component-dl;FE4E80465692A2F9C47C2723D184E933;14093 <record program="SC2" component="enUS">http://dist.blizzard.com.edgesuite.net/sc2patch/update/B14093B/sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-locale-component-dl;sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-locale-component-dl;49750B9F1473283D7DA44622E021833B;14093 <record program="Bnet" component="base">http://dist.blizzard.com.edgesuite.net/sc2patch/update/B14093B/sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-bnet-base-component-dl;sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-bnet-base-component-dl;68CC1B35027ECE4B1D1704666344A29E;14093 <record program="Bnet" component="Win">http://dist.blizzard.com.edgesuite.net/sc2patch/update/B14093B/sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-bnet-bin-component-dl;sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-bnet-bin-component-dl;423205FE7C3D74D01990A1BB37273ADE;14093

You can see the record tag indicates the component that needs to be updated. It has the following structure:

<record program="[...Application name...]" component="[... Component name ...]">[... URL for the dl file ...];[... Name of the dl file ...];[... MD5 hash of the dl file ...];[... version number ...]

Third Step
The client then gets the URLs from here and downloads and install them.

Fourth Step
Then it checks again and if the server returns no update XML data it means that the client is lastest version. If the update server could not be found the launcher continues loading the game. The DL file itself is an MPQ archive. It has (a minimum of) two files: prepatch.lst - contains list of operations the updater should do.

For example:


 * extract sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-game.torrent
 * download sc2-0.2.0.13891-0.3.0.14093-x86-Win-enUS-game.torrent

The torrent file is also in the archive. The first line tells the updater to extract the torrent file (to the Starcraft 2 folder) and the second one is to start downloading it. It uses the blizzard downloader to do that. The actual update file we get by downloading the torrent is also an MPQ archive. (They just love mpqs don't they). It contains the updated files in subdirectories. If an updated file is inside some of the base mpqs they aren't including the full mpq but only the updated file inside it.

For example:


 * \base\Mods\Liberty.SC2Mod\Base.SC2Data\GameData\[...file...].xml

Then in the patch.lst file every line is a file to copy. From there these files are put into the mpqs or just copied to the directory.


 * BlizzardComponent.xml;base/Mods/Core.SC2Mod/Base.SC2Data\BlizzardComponent.xml;base/Mods/Core.SC2Mod/Base.SC2Data
 * BuildId.txt;base/Mods/Core.SC2Mod/Base.SC2Data\BuildId.txt;base/Mods/Core.SC2Mod/Base.SC2Data
 * Assets\Effects\Protoss\BlinkIn\BlinkIn.m3;base/Mods/Liberty.SC2Mod/Base.SC2Assets\Assets\Effects\Protoss\BlinkIn\BlinkIn.m3;base/Mods/Liberty.SC2Mod/Base.SC2Assets
 * [...File path inside the mpq...];[...Path to the file from the root of the downloaded update mpq...];[...Path to the MPQ archive inside the Starcraft2 folder...]
 * patch.cmd contains the build numbers before and after and the Language version.
 * hdfiles.lst and wowtest.lst seem to contain the files that should be in the SC2 folder.
 * delete.lst - files to delete after the patching process.