Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions web_assembly/ch3/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ const projectName = "calculate_primes";
* dependency 없는 간단한 static web server
*/
const server = http.createServer((req, res) => {
if (path.normalize(decodeURI(req.url)) !== decodeURI(req.url)) {
res.statusCode = 403;
res.end();
return;
}

const relativePath = req.url.substr(1);
const filePath = path.resolve(__dirname, relativePath);
const ext = req.url.substr(req.url.lastIndexOf(".") + 1);
Expand Down