Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

How to set-cookie in CGI with C?

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  DocumentRoot Question  
Author Message
user2831

External


Since: Jun 17, 2004
Posts: 1



(Msg. 1) Posted: Thu Jun 17, 2004 3:16 am
Post subject: How to set-cookie in CGI with C?
Archived from groups: alt>apache>configuration (more info?)

in perl, one can use:

use CGI qw/:standard/;
use CGI::Carp 'fatalsToBrowser';
use strict;
....
print "Set-Cookie: user=john;password=secret;path=/;


However, in C if you just use
printf("Content-type: text/html\n\n");
...
printf("Set-Cookie: user=john;password=secret;path=/;");

You get that printed in the screen.

What do you include in order for the cgi to setup the cookie?

Thanks.

Y.

 >> Stay informed about: How to set-cookie in CGI with C? 
Back to top
Login to vote
hans1

External


Since: Mar 29, 2004
Posts: 672



(Msg. 2) Posted: Thu Jun 17, 2004 10:09 pm
Post subject: Re: How to set-cookie in CGI with C? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

"No Spam" <ns.DeleteThis@spamfree.net> schreef in bericht
news:wW8Ac.416$Ny6.1136@mencken.net.nih.gov...
 > in perl, one can use:
 > use CGI qw/:standard/;
 > use CGI::Carp 'fatalsToBrowser';
 > use strict;
 > print "Set-Cookie: user=john;password=secret;path=/;

 > However, in C if you just use
 > printf("Content-type: text/html\n\n");
 > printf("Set-Cookie: user=john;password=secret;path=/;");
 > You get that printed in the screen.
In fact you are writing an HTTPheader directly -no need for CGI for that-
A header of that kind ends with a blanc line...
.... the _ second_ \n in the first printf() is such a line.

All data following that blanc line is considered data and so your browser is
displaying it.


HansH<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: How to set-cookie in CGI with C? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
How to enable cookie in the server - Hi, I am trying setup the Apache 2.0.40 on the RedHat 10. I can't seem to store the cookie. I checked all the environment variables on the server from the browser, HTTP_COOKIE is not listed. The codes for listing the environment are placed after..

Custom 404 causes problems with cookie - In httpd.conf I added ErrorDocument 404 /404/index.php between the <Directory /> and </Directory> tags. In the body I set a cookie called ABC as follows. // Set the ABC cookie, the value determines where the user's browser is directed after...

Tomcat session cookie configuration - Hello, I want to use Tomcat 5 into the following architecture : Apache 2 (host A)-----> Tomcat 5 (host B) Apache 2 has rewrite rules : Client URL : https://www.my_site.org/my_internet_url/my_jsp.jsp (host A) Real URL : ..

Cookie Issues with Main Domain and Subdomains - Good evening folks, I hope this won't be too much of a burden in asking but I seem to be scratching a wooden post down to mere pulp right now. ;) I own the following main domain: nukecops.com From that I have created several subdomains, examples..
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]