Skip to content

Commit

Permalink
Merge branch 'master' of git@github.com:tonyg/reversehttp
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyg committed Aug 3, 2009
2 parents f315651 + 041dbcc commit bc2ef91
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
4 changes: 4 additions & 0 deletions priv/www/demolog.js
Expand Up @@ -11,6 +11,10 @@ function log() {
}
}

function clearLog() {
$("#logOutput").empty();
}

function formatErrorReports(errorReports) {
var r = [];
for (var i = 0; i < errorReports.length; i++) {
Expand Down
3 changes: 3 additions & 0 deletions priv/www/endpoint.html
Expand Up @@ -15,6 +15,9 @@ <h1>PubSubHubBub Endpoint Demo</h1>
<p>
This endpoint is available at URL <a id="endpointLocation" href="???">???</a>.
</p>
<p>
<button onclick="clearLog()">Clear log</button>
</p>
<pre id="logOutput"></pre>
<script type="text/javascript">endpoint_main();</script>
</div>
Expand Down
25 changes: 21 additions & 4 deletions priv/www/httpd.js
Expand Up @@ -66,15 +66,25 @@ Url.prototype.toString = function () {

function parse_qs(qs) {
var result = {};
var multiple = {};
if (qs) {
var keyvals = qs.split('&');
for (var i = 0; i < keyvals.length; i++) {
var eqPos = keyvals[i].indexOf('=');
if (eqPos == -1) {
result[unescape(keyvals[i])] = true;
result[decodeURIComponent(keyvals[i])] = true;
} else {
result[unescape(keyvals[i].substr(0, eqPos))] =
unescape(keyvals[i].substr(eqPos + 1));
var key = decodeURIComponent(keyvals[i].substr(0, eqPos));
var v = decodeURIComponent(keyvals[i].substr(eqPos + 1));
if (typeof result[key] === 'undefined') {
result[key] = v;
} else {
if (!multiple[key]) {
result[key] = [result[key]];
multiple[key] = true;
}
result[key].push(v);
}
}
}
}
Expand All @@ -84,7 +94,14 @@ function parse_qs(qs) {
function unparse_qs(params) {
result = [];
for (var key in params) {
result.push(escape(key) + "=" + escape(params[key]));
var v = params[key];
if (typeof v === 'object' && typeof v.length !== 'undefined') {
for (var i = 0; i < v.length; i++) {
result.push(encodeURIComponent(key) + "=" + encodeURIComponent(v[i]));
}
} else {
result.push(encodeURIComponent(key) + "=" + encodeURIComponent(v));
}
}
return result.join("&");
};
Expand Down
4 changes: 2 additions & 2 deletions priv/www/messaging.js
Expand Up @@ -228,7 +228,7 @@ Messaging.RemoteSource.prototype.subscribe =
Messaging.HubModeRequest(this.url, "POST", "subscribe",
{"hub.callback": callbackUrl,
"hub.topic": topic,
"hub.verify": verifyModes.join(","),
"hub.verify": verifyModes,
"hub.verify_token": token},
function (reply) { return k(reply && reply.isOk()); });
};
Expand All @@ -238,7 +238,7 @@ Messaging.RemoteSource.prototype.unsubscribe =
Messaging.HubModeRequest(this.url, "POST", "unsubscribe",
{"hub.callback": callbackUrl,
"hub.topic": topic,
"hub.verify": verifyModes.join(","),
"hub.verify": verifyModes,
"hub.verify_token": token},
function (reply) { return k(reply && reply.isOk()); });
};
2 changes: 2 additions & 0 deletions priv/www/style.css
Expand Up @@ -50,6 +50,7 @@ div#outerContainer {

div#innerContainer {
padding: 10px;
clear: both;
}

hr {
Expand All @@ -64,6 +65,7 @@ ul.mainNav {
margin: 0;
color: white;
background: #154050;
width: 100%;
border-bottom: 2px solid #6eaa52;
border-right: 2px solid #6eaa52;
}
Expand Down

0 comments on commit bc2ef91

Please sign in to comment.