diff options
Diffstat (limited to 'src/server/httpd/httpd.tcl')
-rw-r--r-- | src/server/httpd/httpd.tcl | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/src/server/httpd/httpd.tcl b/src/server/httpd/httpd.tcl new file mode 100644 index 00000000..b5794114 --- /dev/null +++ b/src/server/httpd/httpd.tcl @@ -0,0 +1,108 @@ +# some dummy proc's to get things going for test purposes
+
+
+
+proc ip {} {
+return 10.0.0.55
+}
+
+proc start_chunked {a} {
+ global httpdata
+ global httpmime
+ set httpmime $a
+ set httpdata ""
+}
+
+proc write_chunked {a} {
+ global httpdata
+ append httpdata $a
+}
+
+proc end_chunked {} {
+}
+
+
+
+#proc formfetch {a} {
+# global httppostdata
+ #catch {
+# echo "$a=$httppostdata($a)"
+ #return $httppostdata($a)
+ #}
+#
+ #return ""
+#}
+
+
+
+
+proc tohex {a} {
+ set r ""
+ while 1 {
+
+ set rem [expr $a%16]
+ set a [expr $a/16]
+ set r [string index "0123456789abcdef" $rem]$r
+ if ($a==0) then break
+ }
+ return $r
+}
+
+# encode text
+proc encode {a} {
+ return [string map {\n <br/> { } { } \t { } > > < < / /} $a]
+}
+
+#stubs that can be overriden to save between sessions
+proc load_var {a} {
+ global glob_var
+ catch {
+ return $glob_var($a)
+ }
+ return ""
+}
+#stubs that can be overriden to save between sessions
+proc save_var {a b} {
+ catch {
+ set glob_var($a) $b
+ return ""
+ } err
+ set glob_var($a) ""
+ return ""
+}
+
+
+
+proc to_textarea {a} {
+ return [string map {& & > > < < / /} $a]
+}
+
+proc from_textarea {a} {
+ return [string map {> > < < & & / /} $a]
+}
+
+proc lunion {a b} {
+ foreach e $a {
+ set x($e) {}
+ }
+ foreach e $b {
+ if {![info exists x($e)]} {
+ lappend a $e
+ }
+ }
+ return $a
+}
+
+
+# encode text
+proc encode {a} {
+ return [string map {\n <br/> { } { } \t { } > > < < / /} $a]
+}
+
+# catch any exceptions, capture output and return it
+proc capture_catch {a} {
+ catch {
+ return [eval {capture $a}]
+ } result
+ return $result
+}
|