Action page (can be other than "/upgrade.lua", depend on Web interface handler) receive request:
Stop watchdog
Stop Wireless
Stop services not used in networking
Stop IPSec? (maybe better to keep it running, for case when corporate admin update boxes remotely)
Allocate memory storage with size of /dev/(map|redboot)/upgrade partition mdconfig -a -t malloc -s8m -o reserve
Run upgrade utility on a separate port with current web interface login/password hash (so upgrade will be able to check it) upgrade -p 79 -H YWRtaW46YWRtaW4= -S /dev/md1
Send redirect header to new port (79 in example)
Browser made new connection to port that port and send form
upgrade accept connection
Verify storage presence (/dev/md1)
Verify browser supplied Authentication hash
Get multipart boundary key
Search for Content-Disposition: form-data; name="firmware"; filename="${firmware name}"
Parse filename to get Vendor, Model, H/W_Rev, Version? and md5 hash (D-Link_DIR-620-0.1-ALPHA.45c7222d56450210c701452833b83201.zimage)
Check Vendor, Model, H/W_Rev
Check Version?
Fetch, md5, store (to /dev/md1) until boundary key