-
Notifications
You must be signed in to change notification settings - Fork 10.1k
Commit
… is the default encoding for http.ServerResponse.write replaced string.length with Buffer.byteLength in jsonp-polling.js, listener.js and xhr-polling.js because content-length header requires number of bytes and not the number of symbols in string
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,7 +135,7 @@ Listener.prototype._serveClient = function(path, req, res){ | |
} | ||
self._clientFiles[path] = { | ||
headers: { | ||
'Content-Length': data.length, | ||
'Content-Length': Buffer.byteLength(data), | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
SlNPacifist
Author
Contributor
|
||
'Content-Type': types[ext], | ||
'ETag': clientVersion | ||
}, | ||
|
New to node/socket.io -- just cloned and installed both. Looks to me like fs.readFile returns a buffer unless you specify encoding? Buffer.byteLength expects a string, not a buffer. Similarly when you serve the file in write, thats expecting a string. I was getting "First argument expected to be string" on running the server and connecting a client until i changed this, then all was well. Feel free to delete this comment if I'm missing something.