stephenlb / nodejuice

Automatic browser refresh on file change or update is what you can call it. NodeJuice is a set of tools which allows you to develop with a push connection to your web browser. JavaScript V8 Seeker Server and Web Server Gateway Interface. nodeJuice Seeker Server works with all other servers including Apache, Passenger, Nginx, Cherokee, and more. A web server isn't required, NodeJuice comes with one in case you forgot yours. It runs on NodeJS; a low level non-blocking network ready process with many capabilities. This is a tool that every web developer needs and has wanted for a very long time. IRC @ #node.js
http://nodejuice.com
Other
78 stars 3 forks source link

Invalid Content-Length #3

Closed suzuryo closed 13 years ago

suzuryo commented 13 years ago

I use "multi byte character (encoding: utf-8)", such as Japanese Language.

"body.length" returns the number of characters in a string.
so I think that is invalid content-length because string is multi byte character.

"Buffer.byteLength" returns the actual byte length of a string.

--- servers/wsgi.js.orig    2010-06-26 11:42:16.000000000 +0900
+++ servers/wsgi.js 2010-11-10 13:30:38.000000000 +0900
@@ -55 +55 @@
-        headers["Content-Length"] = body.length;
+        headers["Content-Length"] = Buffer.byteLength(body);
stephenlb commented 13 years ago

thank you for the patch. applied and published.

suzuryo commented 13 years ago

Any other Content-Length caluculating code may need patches.

stephenlb commented 13 years ago

Yup. The Seeker Server needed this patch as well. Thank you again Suzuryo.