Over-the-air updating firmware through WiFi
I want to add a feature to my device that it can update its own firmware through WiFi. The device is an IoT that will connect to a server. The main idea is the device will poll the server periodically and check if the firmware version is updated. If there is an updated version, it will use HTTPS to "GET" the firmware from the server, and the server "POST" back the firmware.
For testing, I have set up a web server (Apache+mySQL+PHP) in my local area network. However actually I am a not familiar with the IT field, I would like to ask what I have to learn so that I can test the above feature during development?
(I set up the server by XAMPP)
On the other hands, ss the whole firmware certainly exceed the limit of 1460B of a TCP payload, I believe the server has to split the firmware into small pieces, such as 512B. Someone suggested I need many different URL. Each piece of the firmware is an individual URL. And the device "GET" each potion of the firmware from different URL each time. And someone said I can add "cgi" field in the HTTP message. Each potion of the firmware has a number. The server will "POST" back the firmware according to the number in the "cgi" field.
I want to ask in general how they do the OTA updating firmware?
Thanks a lot!:-D