You are viewing a plain text version of this content. The canonical link for it is here.
Posted to rivet-dev@tcl.apache.org by Rani Ahmed <ra...@gmail.com> on 2014/01/02 18:51:52 UTC
Hi. Would you please solve me my problems with sessions and cookies?
I am making a tutorial youtube playlist about Tc/Rivet on this play list:
http://www.youtube.com/playlist?list=PLsAEIIjTPIo9YxfvYeAPfRHyj9d3pxazL
I have posted a question here about Sessions here:
https://groups.google.com/forum/?hl=en#!topic/comp.lang.tcl/HM6r-82dbAo
========
my second question is about cookies according to this code:
http://pastebin.com/GBtH2fEr
and I am getting "headers already sent"
so would you help me?
I am also self-learning Tcl/Rivet and trying to make rivet surface like
PHP.
Re: Hi. Would you please solve me my problems with sessions and cookies?
Posted by Massimo Manghi <mx...@apache.org>.
Hi Rani
On 01/02/2014 06:51 PM, Rani Ahmed wrote:
> I am making a tutorial youtube playlist about Tc/Rivet on this play list:
>
> http://www.youtube.com/playlist?list=PLsAEIIjTPIo9YxfvYeAPfRHyj9d3pxazL
thank you for your efforts. I already out a link on our website pointing
to one of your videos. I will update it with this one
>
> I have posted a question here about Sessions here:
>
> https://groups.google.com/forum/?hl=en#!topic/comp.lang.tcl/HM6r-82dbAo
It doesn't make sense to me the variable ip_address disappeared from the
array in method create_session of class Session. Did you modified
session-class.tcl somehow?
This is the relevant code fragment
set a(ip_address) [env REMOTE_ADDR]
set a(session_start_time) now
set a(session_update_time) now
set a(session_id) [gen_session_id $a(ip_address)]
set kf [list ip_address session_id]
if {![$dioObject store a -table $sessionTable -keyfield $kf]} {
...debug messages here
}
debug "create_session: ip $a(ip_address), id '$a(session_id)'"
return $a(session_id)
I checked also 'store' and 'makekey' in dio.tcl and they don't tamper
with the array except for extracting the keys of the query. So, there
must be a point where this variable vanished into a void....
>
> ========
> my second question is about cookies according to this code:
>
> http://pastebin.com/GBtH2fEr
>
> and I am getting "headers already sent"
>
> so would you help me?
> I am also self-learning Tcl/Rivet and trying to make rivet surface
> like PHP.
I couldn't say where the problem is by looking at the code you published
(it might be hidden somewhere in the templates parsed).
The error "headers already sent" arises when you attempt to set an HTTP
header using Rivet's command 'headers' after the real headers have been
sent to the client. HTTP headers are automatically sent as soon as you
'puts' something to stdout. If you call 'headers' after that point the
real headers have already gone and the requests exits with an error.
This error could be (and often is) related to the first example you
showed where Session had the debug flag set. The debug message facility
is totally unaware of the request processing status: if debugging is on
messages are sent out data whenever a 'debug' command is run, thus
triggering the transmission of the HTTP headers which must go first.
To avoid this it is recommended to output the debugging to a file using
the -debugFile switch.
e.g.
Session ::SESSION -dioObject $dbms \
-debugMode 1 \
-debugFile [open [file join /tmp "session-[pid].log"] w+] \
... everything needed to setup your session object
During the debugging session is useful to reduce the maximum number of
child processes created by httpd
-- Massimo
---------------------------------------------------------------------
To unsubscribe, e-mail: rivet-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: rivet-dev-help@tcl.apache.org