Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Merge remote branch 'origin/v0.4'

Conflicts:
	deps/http_parser/http_parser.c
	deps/http_parser/test.c
	lib/repl.js
  • Loading branch information...
ry committed Sep 15, 2011
2 parents 1b15af9 + e06ce75 commit a1bafc55665e9fe17c831ca23193cf51027af776
Showing with 92 additions and 6 deletions.
  1. +10 −1 lib/module.js
  2. +9 −1 lib/querystring.js
  3. +9 −1 lib/repl.js
  4. +59 −0 test/simple/test-http-multi-line-headers.js
  5. +5 −3 test/simple/test-querystring.js
@@ -25,6 +25,15 @@ var runInThisContext = Script.runInThisContext;
var runInNewContext = Script.runInNewContext;
var assert = require('assert').ok;


// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}


function Module(id, parent) {
this.id = id;
this.exports = {};
@@ -86,7 +95,7 @@ function statPath(path) {
var packageCache = {};

function readPackage(requestPath) {
if (packageCache.hasOwnProperty(requestPath)) {
if (hasOwnProperty(packageCache, requestPath)) {
return packageCache[requestPath];
}

@@ -25,6 +25,14 @@ var QueryString = exports;
var urlDecode = process.binding('http_parser').urlDecode;


// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}


function charCode(c) {
return c.charCodeAt(0);
}
@@ -166,7 +174,7 @@ QueryString.parse = QueryString.decode = function(qs, sep, eq) {
var k = QueryString.unescape(x[0], true);
var v = QueryString.unescape(x.slice(1).join(eq), true);

if (!obj.hasOwnProperty(k)) {
if (!hasOwnProperty(obj, k)) {
obj[k] = v;
} else if (!Array.isArray(obj[k])) {
obj[k] = [obj[k], v];
@@ -46,6 +46,14 @@ var path = require('path');
var fs = require('fs');
var rl = require('readline');

// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}


var context;

var disableColors = true;
@@ -517,7 +525,7 @@ REPLServer.prototype.complete = function(line, callback) {
group.sort();
for (var j = 0; j < group.length; j++) {
c = group[j];
if (!uniq.hasOwnProperty(c)) {
if (!hasOwnProperty(c)) {
completions.push(c);
uniq[c] = true;
}
@@ -0,0 +1,59 @@
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.

var common = require('../common');
var assert = require('assert');

var http = require('http');
var net = require('net');

var gotResponse = false;

var server = net.createServer(function(conn) {
var body = "Yet another node.js server.";

var response =
"HTTP/1.1 200 OK\r\n" +
"Connection: close\r\n" +
"Content-Length: " + body.length + "\r\n" +
"Content-Type: text/plain;\r\n" +
" x-unix-mode=0600;\r\n" +
" name=\"hello.txt\"\r\n" +
"\r\n" +
body;

conn.write(response, function() {
conn.destroy();
server.close();
});
});

server.listen(common.PORT, function() {
http.get({host:'127.0.0.1', port:common.PORT}, function(res) {
assert.equal(res.headers['content-type'],
'text/plain;x-unix-mode=0600;name="hello.txt"');
gotResponse = true;
});
});

process.on('exit', function() {
assert.ok(gotResponse);
});
@@ -49,9 +49,11 @@ var qsTestCases = [
[' foo = bar ', '%20foo%20=%20bar%20', {' foo ': ' bar '}],
['foo=%zx', 'foo=%25zx', {'foo': '%zx'}],
['foo=%EF%BF%BD', 'foo=%EF%BF%BD', {'foo': '\ufffd' }],
[ 'toString=foo&valueOf=bar&__defineGetter__=baz',
'toString=foo&valueOf=bar&__defineGetter__=baz',
{ toString: 'foo',
// See: https://github.com/joyent/node/issues/1707
[ 'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
'hasOwnProperty=x&toString=foo&valueOf=bar&__defineGetter__=baz',
{ hasOwnProperty: 'x',
toString: 'foo',
valueOf: 'bar',
__defineGetter__: 'baz' } ]
];

0 comments on commit a1bafc5

Please sign in to comment.
You can’t perform that action at this time.