helloworld3000.com - An alias of foobar3000.com suitable for testing CORS, XSS, etc.
Open port 5000 on your computer in one terminal and connect to foobar3000 on port 32000 in another.
Text will be echoed back as-is. JSON will be interpretted, if possible.
nc -l -p 5000 # GNU (Linux) netcat
# nc -l 5000 # BSD (OS X) netcat
nc foobar3000.com 32000
Hey you!
{ "keepalive": true }
{ "keepalive": false }
{ "body": "Hello\n" }
{ "body": "Hello\n" }
{ "body": "Hello\n" NOT JSON }
{ "body": "Hello\n", "port": 5000 }
{ "port": 5000 }
{ "body": "Hello\n", "port": 5000 }
Open port 5000 on your computer in one terminal and connect to foobar3000 on port 32000 in another.
Text will be echoed back as-is. JSON will be interpretted, if possible.
nc -u -l -p 5000 # GNU (Linux) netcat
# nc -u -l 5000 # BSD (OS X) netcat
nc -u foobar3000.com 32000
Hey you!
{ "body": "Hello\n" }
{ "body": "Hello\n" NOT JSON }
{ "port": 5000 }
{ "body": "Hello\n", "redial": true }
{ "body": "Hello\n", "port": 5000 }
{ "body": "Hello\n", "redial": true, "port": 5000 }
Text:
curl -v "http://${HOST}" \
-H 'Content-Type: application/json' \
-d '{
"raw": "HTTP/1.1 200 OK\r\nContent-Type: text/plain; charset=utf-8\r\nContent-Length: 12\r\nConnection: keep-alive\r\n\r\nHello World\n"
}'
Binary:
curl -v "http://${HOST}/?rawResponse=true" \
-H 'Content-Type: application/octet-stream' \
-d @hello.http.bin
var buffer
;
function saveBinary(cb, token, path, headers, buffer) {
var xhr2 = new XMLHttpRequest();
xhr2.open('POST', '/meta'
+ '?session=' + encodeURIComponent(token)
+ '&pathname='+ encodeURIComponent(path)
+ '&headers=' + encodeURIComponent(JSON.stringify(headers))
+ '&rawBody=true'
, true);
xhr2.send(buffer);
xhr2.addEventListener('load', function () {
cb(
null
, JSON.parse(xhr2.responseText)
, 'http://foobar3000.com' + path + '?session=' + encodeURIComponent(token)
);
});
}
function onSaved(err, result, url) {
console.log('succeeded');
console.log(url);
}
// "Hello ☢☃ (radioactive snowman in utf-8)"
buffer = new Uint8Array([
72,101,108,108,111,32,226,152,162,226,152,131,32,40,114,97,
100,105,111,97,99,116,105,118,101,32,115,110,111,119,109,
97,110,32,105,110,32,117,116,102,45,56,41,10
]).buffer;
saveBinary(
onSaved
, 'any-token-you-like'
, '/any-path-you-like'
, ["Content-Type: text/plain; charset=utf-8"]
, buffer
);
var jQuery = require('jQuery') // jQuery 1.6.3
, $ = require('ender') // same DOM API as jQuery
, ajax = require('reqwest') // same API as jQuery.ajax
, request = require('ahr2') // similar API to Node.JS' `request`, supports XHR2
;
request('/echo').when(function (err, ahr, data) {
console.log(arguments);
});
// Use foobar3000.com to create a CORS resource
// (attached to session)
function createCorsResource() {
request.post('/meta', null, {
session: "make-up-your-own-key"
, pathname: "/hello-cors"
, headers: [
"Access-Control-Allow-Origin: *"
, "Access-Control-Allow-Methods: POST, GET, PUT, DELETE, OPTIONS"
, "Access-Control-Allow-Headers: Content-Type, Accept"
]
, body: "Hello CORS World!"
}, { headers: { "content-type": "application/json"} }).when(function (err, ahr, data) {
console.log(arguments);
getCorsResource();
});
}
// Access the aforementioned resource from helloworld3000.com
// (must use same session key)
function getCorsResource() {
request.get('http://helloworld3000.com/hello-cors?session=make-up-your-own-key').when(function (err, ahr, data) {
console.log(arguments);
});
}
createCorsResource();
var script = document.createElement('script');
script.src = 'http://foobar3000.com/assets/ender.js';
script = document.body.appendChild(script);