Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to send POST data to a webserver?
#11
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).
Note that the lines are very long so will be wrapped in this display::

Code:
Stat Connected.
Sent 2018-05-02 20:30:17: GET /firmware HTTP/1.1<EOL>Host: 192.168.119.249<EOL>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<EOL>Referer: http://192.168.119.249/firmware<EOL>User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0<EOL>Authorization: Basic YWdpYWRtaW46YWdpdXNh<EOL><EOL>
Recv 2018-05-02 20:30:17: HTTP/1.1 200 OK<EOL>Content-Type: text/html<EOL>Content-Length: 385<EOL>Connection: close<EOL><EOL>
Recv 2018-05-02 20:30:17: <html><head><title>The ESP8266 updater</title></head><LF>     <body><b>WiFi module firmware updater</b><LF>     <br>Select firmware file, then click the Update button!<br><LF>     <form method='POST' action='' enctype='multipart/form-data'><LF>                  <input type='file' name='update'><LF>                  <input type='submit' value='Update'><LF>               </form><LF>         </body></html>
Stat Disconnected.
Stat Connected.
Sent 2018-05-02 20:30:17: POST /firmware HTTP/1.0<EOL>Connection: keep-alive<EOL>Content-Type: multipart/form-data; boundary=--------050218203017201<EOL>Content-Length: 304674<EOL>Host: 192.168.119.249<EOL>Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8<EOL>Referer: http://192.168.119.249/firmware<EOL>User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:59.0) Gecko/20100101 Firefox/59.0<EOL>Authorization: Basic YWdpYWRtaW46YWdpdXNh<EOL><EOL>
Sent 2018-05-02 20:30:17: ----------050218203017201<EOL>Content-Disposition: form-data; name="update"; filename="DHT_MONITOR.bin"<EOL>Content-Type: application/octet-stream<EOL>Content-Transfer-Encoding: binary<EOL><EOL>
<--- here is the binary file content, which I cut away --->
<EOL>----------050218203017201--<EOL>
Recv 2018-05-02 20:30:25: HTTP/1.0 200 OK<EOL>Content-Type: text/html<EOL>Content-Length: 56<EOL>Connection: close<EOL><EOL>
Recv 2018-05-02 20:30:25: Update error: ERROR[10]: Magic byte is wrong, not 0xE9<EOL>
Stat Disconnected.
An interesting item appears at the end. "Magic byte is wrong", whatever that means...
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 BosseB - 05-02-2018, 06:42 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)