I have switched on debugging in FireFox and run a session via the web form.
This is what I caught:
HEADERS:
Request headers:
Accept text/html,application/xhtml+xm…plication/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Authorization Basic YWdpYWRtaW46YWdpdXNh
Connection keep-alive
Content-Length 304673 (Actual file length in bytes is: 304464 bytes)
Content-Type multipart/form-data; boundary=…----------------2651643628205
Host 192.168.119.249
Referer http://192.168.119.249/firmware
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/59.0
Response headers
Connection close
Content-Length 75
Content-Type text/html
PARAMS:
-----------------------------2651643628205
Content-Disposition: form-data; name="update"; filename="DHT_MONITOR.bin"
Content-Type: application/octet-stream
( then follows what appears to be the content of the bin file )
-----------------------------2651643628205--
Response:
Update Success! Rebooting...
Response payload:
<META http-equiv="refresh" content="15;URL=/firmware">Update Success! Rebooting...
Is there something here that I should add into the TIdHTTP component before using POST?
Like this:
I have noted that the Content-Length is always bigger than the actual file size and the difference seems to be close to the same but not exactly so...
I was unable to use Wireshark, could not even find how to set a filter for the IP address or start capturing...
This is what I caught:
HEADERS:
Request headers:
Accept text/html,application/xhtml+xm…plication/xml;q=0.9,*/*;q=0.8
Accept-Encoding gzip, deflate
Accept-Language en-US,en;q=0.5
Authorization Basic YWdpYWRtaW46YWdpdXNh
Connection keep-alive
Content-Length 304673 (Actual file length in bytes is: 304464 bytes)
Content-Type multipart/form-data; boundary=…----------------2651643628205
Host 192.168.119.249
Referer http://192.168.119.249/firmware
Upgrade-Insecure-Requests 1
User-Agent Mozilla/5.0 (Windows NT 6.1; W…) Gecko/20100101 Firefox/59.0
Response headers
Connection close
Content-Length 75
Content-Type text/html
PARAMS:
-----------------------------2651643628205
Content-Disposition: form-data; name="update"; filename="DHT_MONITOR.bin"
Content-Type: application/octet-stream
( then follows what appears to be the content of the bin file )
-----------------------------2651643628205--
Response:
Update Success! Rebooting...
Response payload:
<META http-equiv="refresh" content="15;URL=/firmware">Update Success! Rebooting...
Is there something here that I should add into the TIdHTTP component before using POST?
Like this:
Code:
HTTP.Request.Accept := 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8';
HTTP.Request.AcceptEncoding := 'gzip, deflate';
HTTP.Request.AcceptLanguage := 'en-US,en;q=0.5';
HTTP.Request.ContentType := 'multipart/form-data;';
HTTP.Request.UserAgent := 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0';
I have noted that the Content-Length is always bigger than the actual file size and the difference seems to be close to the same but not exactly so...
I was unable to use Wireshark, could not even find how to set a filter for the IP address or start capturing...