Skip to content

Commit 14d9440

Browse files
[mirotalkc2c] - add HTTP server clientError handler for malformed requests
1 parent ce6b6f4 commit 14d9440

5 files changed

Lines changed: 96 additions & 50 deletions

File tree

.env.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# ====================================================
2-
# MiroTalk C2C v.1.2.80 - Environment Configuration
2+
# MiroTalk C2C v.1.2.81 - Environment Configuration
33
# ====================================================
44

55
# App environment

backend/server.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.80
12+
* @version 1.2.81
1313
*/
1414

1515
require('dotenv').config();
@@ -393,6 +393,16 @@ server.listen(port, null, () => {
393393
}
394394
});
395395

396+
// Handle client errors (malformed/incomplete HTTP requests) gracefully
397+
server.on('clientError', (err, socket) => {
398+
err.code === 'HPE_HEADER_OVERFLOW' || err.message === 'Parse Error'
399+
? log.warn('Client HTTP parse error', { error: err.message, code: err.code })
400+
: log.warn('Client connection error', { error: err.message, code: err.code });
401+
if (socket && !socket.destroyed) {
402+
socket.end('HTTP/1.1 400 Bad Request\r\n\r\n');
403+
}
404+
});
405+
396406
io.on('error', (error) => {
397407
log.error('Socket.IO error:', error);
398408
});

frontend/js/client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* @license For private project or commercial purposes contact us at: license.mirotalk@gmail.com or purchase it directly via Code Canyon:
1010
* @license https://codecanyon.net/item/mirotalk-c2c-webrtc-real-time-cam-2-cam-video-conferences-and-screen-sharing/43383005
1111
* @author Miroslav Pejic - miroslav.pejic.85@gmail.com
12-
* @version 1.2.80
12+
* @version 1.2.81
1313
*/
1414

1515
const roomId = new URLSearchParams(window.location.search).get('room');

package-lock.json

Lines changed: 81 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "mirotalkc2c",
3-
"version": "1.2.80",
3+
"version": "1.2.81",
44
"description": "A free WebRTC Cam-2-Cam browser-based video calls",
55
"main": "server.js",
66
"scripts": {
@@ -58,7 +58,7 @@
5858
"xss": "^1.0.15"
5959
},
6060
"devDependencies": {
61-
"mocha": "^11.7.5",
61+
"mocha": "^11.3.0",
6262
"node-fetch": "^3.3.2",
6363
"nodemon": "^3.1.14",
6464
"prettier": "3.8.1",

0 commit comments

Comments
 (0)