mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-01 10:12:27 +00:00
Transcode ISO-8859-1 in HTTP headers
If we keep making changes like this, redbean might not be a toy anymore. Additional steps are also being taken now to prevent ANSI control codes sent by the client from slipping into logs.
This commit is contained in:
parent
dcbd2b8668
commit
a1677d605a
14 changed files with 675 additions and 161 deletions
|
@ -58,16 +58,38 @@ local function main()
|
|||
Write('<p><em>none</em>\n')
|
||||
end
|
||||
|
||||
Write('<h3>post request html form demo</h3>\n')
|
||||
Write('<form action="/tool/net/redbean-form.lua" method="post">\n')
|
||||
Write('<input type="text" id="firstname" name="firstname">\n')
|
||||
Write('<label for="firstname">first name</label>\n')
|
||||
Write('<br>\n')
|
||||
Write('<input type="text" id="lastname" name="lastname">\n')
|
||||
Write('<label for="lastname">last name</label>\n')
|
||||
Write('<br>\n')
|
||||
Write('<input type="submit" value="Submit">\n')
|
||||
Write('</form>\n')
|
||||
Write([[
|
||||
<h3>post request html form demo</h3>
|
||||
<form action="/tool/net/redbean-form.lua" method="post">
|
||||
<input type="text" id="firstname" name="firstname">
|
||||
<label for="firstname">first name</label>
|
||||
<br>
|
||||
<input type="text" id="lastname" name="lastname">
|
||||
<label for="lastname">last name</label>
|
||||
<br>
|
||||
<input type="submit" value="Submit">
|
||||
</form>
|
||||
]])
|
||||
|
||||
Write([[
|
||||
<h3>xmlhttprequest request demo</h3>
|
||||
<input id="x" value="lâtìn1">
|
||||
<label for="x">name</label><br>
|
||||
<button id="send">send (via http header)</button><br>
|
||||
<div id="result"></div>
|
||||
<script>
|
||||
function OnSend() {
|
||||
var r = new XMLHttpRequest();
|
||||
r.onload = function() {
|
||||
document.getElementById("result").innerText = this.getResponseHeader('X-Custom-Header');
|
||||
};
|
||||
r.open('POST', '/tool/net/redbean-xhr.lua');
|
||||
r.setRequestHeader('X-Custom-Header', document.getElementById('x').value);
|
||||
r.send();
|
||||
}
|
||||
document.getElementById('send').onclick = OnSend;
|
||||
</script>
|
||||
]])
|
||||
end
|
||||
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue