Permalink
Browse files

Bugfix: node.http.ServerRequest.setBodyEncoding('ascii') not working

  • Loading branch information...
1 parent 9b3baf3 commit 216fb3b9b2811444228d7af7a450839e58b80713 @ry ry committed Aug 6, 2009
Showing with 6 additions and 6 deletions.
  1. +6 −6 src/net.cc
View
@@ -428,19 +428,19 @@ 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++) {
unsigned char val = static_cast<const unsigned char*>(buf)[i];
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());

0 comments on commit 216fb3b

Please sign in to comment.