Forum Discussion
Stefan_126426
Jan 03, 2013Nimbostratus
Hi Nitass
That works perfectly, many thanks for your time and effort.
Could you just confirm I understand this code correctly please? (apologies, this is a new language for me and I like to learn ;-))
set myValues [HTTP::header values "Set-Cookie"] <-- This creates array or equivilent of "Set-Cookie" Headers and values.
HTTP:: header remove "Set-Cookie" <-- removes all headers with "Set-Cookie"
For each, well thats obvious
Now the scan line is a bit more interesting:
scan [lindex $mycookies 0] {%[^=]=%[^;]} currentname currentvalue
OK scan is for parsing strings. I am guessing that lindex $mycookes 0 will actually return the whole string of the cookie including flags and is just a different way of getting these values. There would not be anything in position 1?
Now the next bit looks like a regular expression..But not quite? It seems to say "anything up to the first equals From the first equals anything up to the first semicolon" What I don't get is how this ties into the two variables. How does it define the start and end of a string to go into the variable? Is it simple on the ^=? As ^ appears to be a "stop here"?
The rest of course makes sense.
Once again, many thanks for your time and effort on this, it is greatly appreciated.