You are viewing a plain text version of this content. The canonical link for it is here.
Posted to websh-dev@tcl.apache.org by Ulrich Schoebel <ul...@24-7-internet-marketing.com> on 2005/05/18 23:34:31 UTC

cookiecontext

Hi Ronnie,

17. Sep. 2004 I wrote:
> the LC_TIME patch works perfectly...

Unfortunately that's not entirely correct.
I have set LANG=de_DE@euro in my
environment, LC_TIME is not set. The log
files show a date format of dd.mm.yyyy
until a commit for a cookiecontext is executed.
Thereafter the format switches to mm/dd/yy.

In a certain obscure way Tcl or Websh
remembers the date format until a
"clock format" is executed.

As a workaround I inserted a "clock format 0"
after every commit of a cookiecontext.
It accomplishes nothing but a reset to the
former date format and a (admittedly small)
loss of performance.

It's probably possible to insert this line in
generic/cookie.ws3 to hide this bug from
the user, but it's nevertheless an ugly hack.
I would rather know the reason for this
behaviour (and, of course, have it fixed),
but I'm clueless where to look. Any idea?

Kind regards

Ulrich

PS: When will a new release containing
all the bug fixes be available at apache.org?



---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: cookiecontext

Posted by Ronnie Brunner <ro...@netcetera.ch>.
Hi Ulrich

> > What version of Tcl are you working with?
> 8.4.6

I can't reproduce your problem. I tried with several Tcl Versions
(from 8.4.0 upto 8.5a2) cgi and mod_websh ..., but only on Solaris
What OS are you working on?

Can you reproduce your results when running the script as cgi? (just
put the finalizer at the end of the script and run it as follows:
websh3.5.1a1 test.ws3)

And what does your log file look like? Mine looks always like:

05/22/05 22:48:59 [20399] websh.info: web::dispatch: Handling command "default"
05/22/05 22:48:59 [20399] ws3.debug: Starting command default
05/22/05 22:48:59 [20399] ws3.debug: Updating cookie
05/22/05 22:48:59 [20399] ws3.debug: Before commit
05/22/05 22:48:59 [20399] ws3.debug: After commit
05/22/05 22:48:59 [20399] ws3.debug: Generate a page
05/22/05 22:48:59 [20399] ws3.debug: Page containing 'clock format' done
05/22/05 22:48:59 [20399] ws3.debug: Sending page
05/22/05 22:48:59 [20399] ws3.debug: done
05/22/05 22:48:59 [20399] finalizer.info: shutting down interp

Regards
Ronnie

> > First we should track down the actual problem. If it's really a Tcl
> > problem, let them fix it (maybe with our help). If not, than we have a
> > problem in Websh and I hope we find a way to fix the cause, not just
> > the symptoms ;-)
> Curing the symptoms is pretty easy. I'm interested in the cause, too.
> 
> >
> > A stripped down version of the relevant code would also help.
> See below. When I tried this stripped down version, I noticed, that
> it works correctly on the first request (of an interpreter). The symptom
> shows up from the second request onwards.(?)
>  
> > I know, I know ... I wanted to make sure the Windows build is fixed
> > before we release an update, and I would prefer a more stable
> > autoconf / configure setup. But it might be that it's better to at
> > least have the bugs fixed.
> Definitely! And don't forget the "Fehlende-Dateien" ;-)
> 
> Regards
> 
> Ulrich
> 
> Now for the code (test.ws3), remember my environment,
> LANG=de_DE@euro
> LC_TIME not set:
> 
> web::cookiecontext mycookie -path / -expires "2 week"
> 
> web::initializer {
>   # perReqCleanup drops logging configuration after every request
>   # we don't want that
>   proc web::ap::perReqCleanup {} {}
>   # init logging
>   web::logdest add *.-debug file -unbuffered /yourpath/ws3.log
>   web::logfilter add *.-debug
> }
> 
> web::finalizer {
>   web::log finalizer.info "shutting down interp"
>   }
> 
> web::command default {
>   web::log ws3.debug "Starting command default"
>   mycookie::init dummy
>   web::log ws3.debug "Updating cookie"
>   set visits [mycookie::cget nvisits 0]
>   incr visits
>   mycookie::cset nvisits $visits
>   mycookie::cset lvisit [clock seconds]
>   web::log ws3.debug "Before commit"
>   mycookie::commit
>   web::log ws3.debug "After commit"
>   # redirect response to a variable
>   set chan [web::response -select #out]
>   web::response -sendheader 0
>   # generate a page
>   web::log ws3.debug "Generate a page"
>   web::put "This is a test page [clock format [clock seconds]]"
>   web::log ws3.debug "Page containing 'clock format' done"
>   # send the response
>   web::response -select $chan
>   web::log ws3.debug "Sending page"
>   web::put $out
>   web::log ws3.debug "done"
> }
> 
> web::dispatch
> mycookie::delete
> 
> 
> To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
> For additional commands, e-mail: websh-dev-help@tcl.apache.org
> 

-----------------------------------------------------------------------
Ronnie Brunner                              ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich, phone +41 44 247 79 79 fax +41 44 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: cookiecontext

Posted by Ulrich Schoebel <ul...@24-7-internet-marketing.com>.
Hi Ronnie,

Am Donnerstag, 19. Mai 2005 16:45 schrieben Sie:
>
> What version of Tcl are you working with?
8.4.6

>
> First we should track down the actual problem. If it's really a Tcl
> problem, let them fix it (maybe with our help). If not, than we have a
> problem in Websh and I hope we find a way to fix the cause, not just
> the symptoms ;-)
Curing the symptoms is pretty easy. I'm interested in the cause, too.

>
> A stripped down version of the relevant code would also help.
See below. When I tried this stripped down version, I noticed, that
it works correctly on the first request (of an interpreter). The symptom
shows up from the second request onwards.(?)
 
> I know, I know ... I wanted to make sure the Windows build is fixed
> before we release an update, and I would prefer a more stable
> autoconf / configure setup. But it might be that it's better to at
> least have the bugs fixed.
Definitely! And don't forget the "Fehlende-Dateien" ;-)

Regards

Ulrich

Now for the code (test.ws3), remember my environment,
LANG=de_DE@euro
LC_TIME not set:

web::cookiecontext mycookie -path / -expires "2 week"

web::initializer {
  # perReqCleanup drops logging configuration after every request
  # we don't want that
  proc web::ap::perReqCleanup {} {}
  # init logging
  web::logdest add *.-debug file -unbuffered /yourpath/ws3.log
  web::logfilter add *.-debug
}

web::finalizer {
  web::log finalizer.info "shutting down interp"
  }

web::command default {
  web::log ws3.debug "Starting command default"
  mycookie::init dummy
  web::log ws3.debug "Updating cookie"
  set visits [mycookie::cget nvisits 0]
  incr visits
  mycookie::cset nvisits $visits
  mycookie::cset lvisit [clock seconds]
  web::log ws3.debug "Before commit"
  mycookie::commit
  web::log ws3.debug "After commit"
  # redirect response to a variable
  set chan [web::response -select #out]
  web::response -sendheader 0
  # generate a page
  web::log ws3.debug "Generate a page"
  web::put "This is a test page [clock format [clock seconds]]"
  web::log ws3.debug "Page containing 'clock format' done"
  # send the response
  web::response -select $chan
  web::log ws3.debug "Sending page"
  web::put $out
  web::log ws3.debug "done"
}

web::dispatch
mycookie::delete


---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org


Re: cookiecontext

Posted by Ronnie Brunner <ro...@netcetera.ch>.
Hi Ulrich

> In a certain obscure way Tcl or Websh
> remembers the date format until a
> "clock format" is executed.
> 
> As a workaround I inserted a "clock format 0"
> after every commit of a cookiecontext.
> It accomplishes nothing but a reset to the
> former date format and a (admittedly small)
> loss of performance.

What version of Tcl are you working with?

First we should track down the actual problem. If it's really a Tcl
problem, let them fix it (maybe with our help). If not, than we have a
problem in Websh and I hope we find a way to fix the cause, not just
the symptoms ;-)

A stripped down version of the relevant code would also help.

> PS: When will a new release containing
> all the bug fixes be available at apache.org?

I know, I know ... I wanted to make sure the Windows build is fixed
before we release an update, and I would prefer a more stable
autoconf / configure setup. But it might be that it's better to at
least have the bugs fixed.

Regards
Ronnie
-----------------------------------------------------------------------
Ronnie Brunner                              ronnie.brunner@netcetera.ch
Netcetera AG, 8040 Zuerich, phone +41 44 247 79 79 fax +41 44 247 70 75

---------------------------------------------------------------------
To unsubscribe, e-mail: websh-dev-unsubscribe@tcl.apache.org
For additional commands, e-mail: websh-dev-help@tcl.apache.org