nedap server: utf-8 encoding

This commit is contained in:
Astro 2011-04-23 19:57:58 +02:00
parent 1791a3f79e
commit 700629343a
2 changed files with 8 additions and 7 deletions

2
TODO
View File

@ -45,7 +45,7 @@
= Hotfixes =
nedap flush
nedap encoding
DONE: nedap encoding
timeout sound
irc+nedap auf 1. screen
overload

View File

@ -3,6 +3,7 @@ var wss = require('websocket-server');
var ltx = require('ltx');
var WS_KEY = 'nedap-kneemFothbedchoadHietEnobKavLub1';
var MIME_HTML = 'text/html; charset=UTF-8';
var backend, question, answers, scores;
@ -74,11 +75,11 @@ console.log({question:question,answers:answers})
form.c('input', { type: 'submit',
value: 'Submit' });
res.writeHead(200, { 'Content-type': 'text/html' });
res.writeHead(200, { 'Content-type': MIME_HTML });
res.write(html(form.toString()));
res.end();
} else {
res.writeHead(404, { 'Content-type': 'text/html' });
res.writeHead(404, { 'Content-type': MIME_HTML });
res.write(html('<p>No question left on server.</p>'));
res.end();
}
@ -92,22 +93,22 @@ console.log({question:question,answers:answers})
scores[i]++;
updateBackend();
res.writeHead(303, { 'Content-type': 'text/html',
res.writeHead(303, { 'Content-type': MIME_HTML,
'Location': '/thanks' });
res.end();
} else {
res.writeHead(400, { 'Content-type': 'text/html',
res.writeHead(400, { 'Content-type': MIME_HTML,
'Location': '/' });
res.end();
}
} else {
res.writeHead(400, { 'Content-type': 'text/html' });
res.writeHead(400, { 'Content-type': MIME_HTML });
res.end();
}
});
app.get('/thanks', function(req, res) {
res.writeHead(200, { 'Content-type': 'text/html' });
res.writeHead(200, { 'Content-type': MIME_HTML });
res.write(html("<p>Thanks, your vote may have been counted.</p>"));
res.end();
});