Lynx removes newline characters from post_data input
I am trying to post a file to a URL via the MS-DOS command prompt. I am using the Lynx browser to do this. I am able to post my file just fine, but all of the newline characters are removed by Lynx before creating the POST request. Is it possible to post a file via command line without having the newline characters removed? The command I am running is:
lynx -post_data http://www开发者_如何学Python.myserver.com/myscript.pl < testfile.txt
The input file, testfile.txt, looks like this:
test=This
is
a
test.;
---
The data that actually gets sent across the wire looks like this:
test=Thisisatest.;
I actually found cURL to be a far better utility to post a file via MS-DOS.
I believe that you need to have your special characters URLENCODED for this to work. According to this Lynx page:
Forms most commonly are submitted to http servers with the content encoded as ENCTYPE="application/x-www-form-urlencoded" for analysis by a script, and Lynx treats that as the default if no ENCTYPE is specified in the FORM start tag. However, you can specify a mailto URL as the form's ACTION to have the form content sent, instead, to an email address. In such cases, you may wish to specify ENCTYPE="text/plain" in the form markup, so that the content will not be encoded, but remain readable as plain text.
This means that spaces become %20 and newlines become %0A
精彩评论