I'm writing some web forms which test servers written by students as an exercise. Some of the servers don't quite work to specification, as expected with class work. It would be useful to append a Windows new line character (i.e. \r\n
) to a POST
request generated by a browser, as some servers are doing a ReadLine
rather than using the Content-Length:
header count.
I'm looking at generating the following request (from IE):
POST /Brian HTTP/1.1
Accept: text/html, application/xhtml+xml, */*
Accept-Language: en-GB
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko
Content-Type: application/x-www-form-urlencoded
Accept-Encoding: gzip, deflate
Host: localhost:43
Content-Length: 8
DNT: 1
Connection: Keep-Alive
Cache-Control: no-cache
location
but appending a \r\n
to the end. My attempt at doing this so far is:
<form>
Username: <input type="text" name="url" id="url4"
onChange="document.getElementById('update4').setAttribute('action',
'http://localhost:43/' + document.getElementById('url4').value);"> </input>
</form>
<form id="update4" method="post" action="http://localhost:43/">
Location: <input type="text" name="isindex" id="location5"
onChange="document.getElementById('location5').value =
document.getElementById('location5').value + '\\\r\\\n'"> </input>
<input id="mysubmit3" type="submit" value="go" ></input>
</form>
I know that appending newlines to things can be tricky, so I'm looking for guidance. I don't want the newline characters encoded as part of the POST. I just want to send a raw \r\n
after the POST
command to flush the post through.