Use Debug URLs

The /debug URL domain has URLs that let you poke at the state of the server.

The two I use most often are /debug/source, which reloads code into the server, and /debug/pvalue, which prints variable values. Instead of restarting the server if you modify your code, you can ask tclhttpd to source it with

 http://myserver:8015/debug/source?source=myfile.tcl

The filename is retricted. If you said "source=/etc/passwd" then it would drop the leading /etc/ and only use "passwd". Then, it looks for that file in the main tclhttpd lib directory and in your custom code directory. (Only the most recent versions look properly in the custom code directory.) So, this is fairly safe because it only loads code from directories you control, and it doesn't expose system files in any way.

To print a variable, or an array, or all the variables in a namespace, use

 http://myserver:8015/debug/pvalue?aname=varnamepattern

The varnamepattern is passed to "info vars", so you can include * in it. To see everything in the counter:: namespace, for example:

 http://myserver:8015/debug/pvalue?aname=counter::*


Updated on 19 Aug 2003, 15:04 GMT
Search - Recent Changes - Reference - Index - Go to Beedub's Wiki - Help