summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan <ry@tinyclouds.org>2009-08-06 13:29:24 +0200
committerRyan <ry@tinyclouds.org>2009-08-06 13:29:24 +0200
commit216fb3b9b2811444228d7af7a450839e58b80713 (patch)
tree96f4ab248b15465372394b63345023ffcaae5de4
parent9b3baf3d508dbef355b2952b15b5dd3f854f92cb (diff)
downloadnode-new-216fb3b9b2811444228d7af7a450839e58b80713.tar.gz
Bugfix: node.http.ServerRequest.setBodyEncoding('ascii') not working
Pointed out by Felix Geisendörfer. http://groups.google.com/group/nodejs/browse_thread/thread/d061fe62eba6d3b3#
-rw-r--r--src/net.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/net.cc b/src/net.cc
index 191a5df6fb..f701cf0c44 100644
--- a/src/net.cc
+++ b/src/net.cc
@@ -428,12 +428,7 @@ Connection::OnReceive (const void *buf, size_t len)
Handle<Value> argv[argc];
if(len) {
- if(encoding_ == UTF8) {
- // utf8 encoding
- Handle<String> chunk = String::New((const char*)buf, len);
- argv[0] = chunk;
-
- } else {
+ if (encoding_ == RAW) {
// raw encoding
Local<Array> array = Array::New(len);
for (size_t i = 0; i < len; i++) {
@@ -441,6 +436,11 @@ Connection::OnReceive (const void *buf, size_t len)
array->Set(Integer::New(i), Integer::New(val));
}
argv[0] = array;
+
+ } else {
+ // utf8 or ascii encoding
+ Handle<String> chunk = String::New((const char*)buf, len);
+ argv[0] = chunk;
}
} else {
argv[0] = Local<Value>::New(Null());