Source of http-echo

/* appjet:version 0.1 */ import("dns"); /**  * Replaces < and > with their HTML entity equivalents  */ String.prototype.toHtmlEntities = function() {     return this.replace('<''<').replace('>''>'); }; // returns the HTTP Request print(H2("HTTP Request Echo")); print(H4("Client IP(s)")); // multiple IPs ? var ips = request.clientAddr.split(', '); ips.forEach(function(ip) {     printp(ip + " : " + gethostbyaddr(ip)); }); print(H4("Method")); print(raw('<div id="method">'+request.method.toHtmlEntities()+'</div>')); print(H4("Host")); print(raw('<div id="host">' + request.headers.Host + '</div>')); print(H4("Path")); print(raw('<div id="path">'+request.path.toHtmlEntities()+'</div>')); print(H4("Headers")); print(raw('<ul id="headers">')); for(var x in request.headers) {     print(raw('<li class="header">'+x+'='+request.headers[x].toHtmlEntities()+'</li>')); } print(raw('</ul>')); print(H4("Parameters")); if (keys(request.params).length > 0) {     print(raw('<ul id="params">'));     for(var x in request.params) {         print(raw('<li class="param">'+x+'='+request.params[x].toHtmlEntities()+'</li>'));     }     print(raw('</ul>')); } print(H4("Cookies")); if (keys(request.cookies).length > 0) {     print(raw('<ul id="cookies">'));     for(var x in request.cookies) {         print(raw('<li class="cookies">'+x+'='+request.cookies[x].toHtmlEntities()+'</li>'));     }     print(raw('</ul>')); } /* appjet:css */ body { font-size: 12px; }

Go Back to this app | Get plain source

Powered by AppJet on JGate
source
rendered in 0.161s