Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
node-http-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
node-http-proxy
Commits
a6d45545
Commit
a6d45545
authored
Oct 28, 2011
by
Maciej Małecki
Committed by
Cédric de Saint Martin
Jan 03, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[test] Add common.js file from core
Modifications: * add `PROXY_PORT` constant
parent
377de9ec
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
145 additions
and
0 deletions
+145
-0
test/core/common.js
test/core/common.js
+145
-0
No files found.
test/core/common.js
0 → 100644
View file @
a6d45545
// 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
path
=
require
(
'
path
'
);
var
assert
=
require
(
'
assert
'
);
exports
.
testDir
=
path
.
dirname
(
__filename
);
exports
.
fixturesDir
=
path
.
join
(
exports
.
testDir
,
'
fixtures
'
);
exports
.
libDir
=
path
.
join
(
exports
.
testDir
,
'
../lib
'
);
exports
.
tmpDir
=
path
.
join
(
exports
.
testDir
,
'
tmp
'
);
exports
.
PORT
=
12346
;
exports
.
PROXY_PORT
=
1234567
;
if
(
process
.
platform
==
'
win32
'
)
{
exports
.
PIPE
=
'
\\\\
.
\\
pipe
\\
libuv-test
'
;
}
else
{
exports
.
PIPE
=
exports
.
tmpDir
+
'
/test.sock
'
;
}
var
util
=
require
(
'
util
'
);
for
(
var
i
in
util
)
exports
[
i
]
=
util
[
i
];
//for (var i in exports) global[i] = exports[i];
function
protoCtrChain
(
o
)
{
var
result
=
[];
for
(;
o
;
o
=
o
.
__proto__
)
{
result
.
push
(
o
.
constructor
);
}
return
result
.
join
();
}
exports
.
indirectInstanceOf
=
function
(
obj
,
cls
)
{
if
(
obj
instanceof
cls
)
{
return
true
;
}
var
clsChain
=
protoCtrChain
(
cls
.
prototype
);
var
objChain
=
protoCtrChain
(
obj
);
return
objChain
.
slice
(
-
clsChain
.
length
)
===
clsChain
;
};
exports
.
ddCommand
=
function
(
filename
,
kilobytes
)
{
if
(
process
.
platform
==
'
win32
'
)
{
return
'
"
'
+
process
.
argv
[
0
]
+
'
" "
'
+
path
.
resolve
(
exports
.
fixturesDir
,
'
create-file.js
'
)
+
'
" "
'
+
filename
+
'
"
'
+
(
kilobytes
*
1024
);
}
else
{
return
'
dd if=/dev/zero of="
'
+
filename
+
'
" bs=1024 count=
'
+
kilobytes
;
}
};
exports
.
spawnPwd
=
function
(
options
)
{
var
spawn
=
require
(
'
child_process
'
).
spawn
;
if
(
process
.
platform
==
'
win32
'
)
{
return
spawn
(
'
cmd.exe
'
,
[
'
/c
'
,
'
cd
'
],
options
);
}
else
{
return
spawn
(
'
pwd
'
,
[],
options
);
}
};
// Turn this off if the test should not check for global leaks.
exports
.
globalCheck
=
true
;
process
.
on
(
'
exit
'
,
function
()
{
if
(
!
exports
.
globalCheck
)
return
;
var
knownGlobals
=
[
setTimeout
,
setInterval
,
clearTimeout
,
clearInterval
,
console
,
Buffer
,
process
,
global
];
if
(
global
.
errno
)
{
knownGlobals
.
push
(
errno
);
}
if
(
global
.
gc
)
{
knownGlobals
.
push
(
gc
);
}
if
(
global
.
DTRACE_HTTP_SERVER_RESPONSE
)
{
knownGlobals
.
push
(
DTRACE_HTTP_SERVER_RESPONSE
);
knownGlobals
.
push
(
DTRACE_HTTP_SERVER_REQUEST
);
knownGlobals
.
push
(
DTRACE_HTTP_CLIENT_RESPONSE
);
knownGlobals
.
push
(
DTRACE_HTTP_CLIENT_REQUEST
);
knownGlobals
.
push
(
DTRACE_NET_STREAM_END
);
knownGlobals
.
push
(
DTRACE_NET_SERVER_CONNECTION
);
knownGlobals
.
push
(
DTRACE_NET_SOCKET_READ
);
knownGlobals
.
push
(
DTRACE_NET_SOCKET_WRITE
);
}
if
(
global
.
ArrayBuffer
)
{
knownGlobals
.
push
(
ArrayBuffer
);
knownGlobals
.
push
(
Int8Array
);
knownGlobals
.
push
(
Uint8Array
);
knownGlobals
.
push
(
Int16Array
);
knownGlobals
.
push
(
Uint16Array
);
knownGlobals
.
push
(
Int32Array
);
knownGlobals
.
push
(
Uint32Array
);
knownGlobals
.
push
(
Float32Array
);
knownGlobals
.
push
(
Float64Array
);
knownGlobals
.
push
(
DataView
);
}
for
(
var
x
in
global
)
{
var
found
=
false
;
for
(
var
y
in
knownGlobals
)
{
if
(
global
[
x
]
===
knownGlobals
[
y
])
{
found
=
true
;
break
;
}
}
if
(
!
found
)
{
console
.
error
(
'
Unknown global: %s
'
,
x
);
assert
.
ok
(
false
,
'
Unknown global found
'
);
}
}
});
// This function allows one two run an HTTP test agaist both HTTPS and
// normal HTTP modules. This ensures they fit the same API.
exports
.
httpTest
=
function
httpTest
(
cb
)
{
};
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment