Re: Tclhttpd: why not return the HTTP status from Direct_Url?
- From: EL <eckhardnospam@xxxxxx>
- Date: Mon, 31 Mar 2008 20:27:04 +0200
tunity schrieb:
I believe tnamespace convention is your own design (given the syntax
you use) and not something that tclhttpd does automatically.
Could be...
Perhaps it is so because there is a separate API call just for that
and it is more general:
Httpd_AddHeaders $socket $header $value
Well, it works perfectly when I let Httpd_ReturnData handle the status. I made the changes to lib/direct.tcl (see patch below). However, not thouroughly tested, thats why it worries me a little. It boils down to the question "why it raises an error in return codes other than 0 and 302 originally?"
My idea is to use Direct_Url's as callback handlers for AJAX async requests. These handlers use HTTP codes, especially 200/400 to evaluate the result...
Eckhard
--- tclhttpd3.5.1/lib/direct.tcl 2003-04-04 06:10:54.000000000 +0200
+++ mytclhttpd/lib/direct.tcl 2008-03-30 22:45:06.000000000 +0200
@@ -189,10 +189,15 @@
#
proc DirectRespond {sock code result {type text/html}} {
+ set status 200
switch $code {
0 {
# Fall through to Httpd_ReturnData.
}
+ 1 {
+ # set status to 400, the error
+ set status 400
+ }
302 {
# Redirect.
@@ -201,10 +206,10 @@
}
default {
# Exception will cause error page to be returned.
-
- global errorInfo errorCode
- return -code $code -errorinfo $errorInfo -errorcode $errorCode \
- $result
+ set status $code
+ #global errorInfo errorCode
+ #return -code $code -errorinfo $errorInfo -errorcode $errorCode \
+ # $result
}
}
@@ -215,6 +220,6 @@
# the global cookie array.
Cookie_Save $sock
- Httpd_ReturnData $sock $type $result
+ Httpd_ReturnData $sock $type $result $status
return ""
}
.
- References:
- Prev by Date: Re: positioning tk_getOpenFile dialog
- Next by Date: compiling an app under Linux, looking for library files and headers
- Previous by thread: Re: Tclhttpd: why not return the HTTP status from Direct_Url?
- Next by thread: buy replica handbag online,buy louis vuitton handbag online,buy chanel handbag online,buy Gucci handbag online
- Index(es):
Relevant Pages
|