title: Appending newlines characters (i.e. \r\n) to a form field sent in a post request
body: <p>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. <code>\r\n</code>) to a <code>POST</code> request generated by a browser, as some servers are doing a <code>ReadLine</code> rather than using the <code>Content-Length:</code> header count.</p>
  
  <p>I'm looking at generating the following request (from IE):</p>
  
  <pre class="lang-none prettyprint-override"><code>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
  </code></pre>
  
  <p>but appending a <code>\r\n</code> to the end. My attempt at doing this so far is:</p>
  
  <pre><code>&lt;form&gt; 
  Username: &lt;input type="text" name="url" id="url4"
      onChange="document.getElementById('update4').setAttribute('action', 
      'http://localhost:43/' + document.getElementById('url4').value);"&gt; &lt;/input&gt; 
  &lt;/form&gt;
  &lt;form id="update4" method="post" action="http://localhost:43/"&gt;
  Location: &lt;input type="text" name="isindex" id="location5" 
   onChange="document.getElementById('location5').value = 
               document.getElementById('location5').value + '\\\r\\\n'"&gt; &lt;/input&gt;
  &lt;input id="mysubmit3" type="submit" value="go" &gt;&lt;/input&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>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 <code>\r\n</code> after the <code>POST</code> command to flush the post through.</p>