Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to send POST data to a webserver?
#12
(05-02-2018, 06:42 PM)BosseB Wrote: Thanks, got the Indy logging working.
Here is a cut-down version of the logfile produced (I have removed the binary file data after verifying that it starts and ends with the bytes at the beginning and end of the file).

Off hand, I don't see anything that should be preventing the POST from succeeding.

The only real difference I see between the Indy log and the Firefox log you showed earlier is the lack of "Accept-Encoding", "Accept-Language"[/font], and "Upgrade-Insecure-Requests" headers on Indy's part, but those are optional and don't affect your ability to upload the firmware update file.

On a side note, you should not be specifying a Referer in the initial GET request that retrieves the webform HTML, only when submitting the webform. The Referer is the URL that is *automatically* requesting another URL. When submitting a webform, the Referer is the URL of the webform's HTML, which is submitting to the URL that the webform specifies. When first retrieving the webform HTML, the Referer is usually the user, so you don't need to specify a Referer in that GET request. This also doesn't affect your ability to upload the firmware update file, but it is just to match what a web browser would do.

Incidentally, since HTTP cookies are not involved, the initial GET is optional, you can probably remove it now.

(05-02-2018, 06:42 PM)BosseB Wrote: Note that the lines are very long so will be wrapped in this display::

TIdLogFile has a few properties to customize the log output. For instance, turning off timestamps by setting LogTime=False, and preserving line breaks by setting ReplaceCRLF=False.

(05-02-2018, 06:42 PM)BosseB Wrote: An interesting item appears at the end. "Magic byte is wrong", whatever that means...

That implies that the firmware update file itself is wrong or corrupted. There is likely a special byte inside of the file that the device is looking for to validate the file before modifying the firmware. You should compare the POST request params that you capture from Firefox with the POST request params that you capture from Indy, and make sure the actual "binary file content" of the firmware update file that is being POST'ed match exactly (they should).

Reply


Messages In This Thread
How to send POST data to a webserver? - by BosseB - 04-30-2018, 09:56 PM
RE: How to send POST data to a webserver? - by rlebeau - 05-03-2018, 07:11 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)