Michael Sweet mike at
Sun Jun 17 07:12:30 PDT 2007

vladimir wrote:
> I try to store some information received from user by using of httpSetCookie/httpGetCookie pair. The user's information will be used for    jobs filtration by name served by QUERY facility. For example, user is entering jobs section by follow link:
> http://hostname:631/jobs/?key=filter,
> there "filter" is filtering condition. In jobs.cgi module I do something like :
> if(cgiGetVariable("key"))
>     httpSetCookie(http,cgiGetVariable("key"));
> and after that in cgiShowJObs():
> cgiSetVariable("QUERY",key=httpGetCookie(http));
> It is works, but only first time, so if user change section to Classes, for ex. and then come back - I can not receive any value of cookie.
> Is httpSetCookie() really "set" cookie in browser or manipulate by HTTP fields only?

It just sets the cookie value when making new HTTP requests from your
CGI.  Similarly, cgiSetVariable() only sets the local variable list
and doesn't create a persistent variable for future runs of the CGI.

You'll need to send the corresponding HTTP headers via stdout prior
to the final "Content-Type: text/html"...

Michael Sweet, Easy Software Products           mike at easysw dot com
Internet Printing and Document Software

More information about the cups mailing list