Connecting Tech Pros Worldwide Forums | Help | Site Map

HTTP and CGI

Newbie
 
Join Date: Oct 2008
Posts: 5
#1: Oct 30 '08
First and foremost, allow me introduce myself.
I am an active duty United States Marine stationed in Georgia. I have been a hobbyist programmer for the better part of my life, and my language of choice is usually Java. I hope that much suffices as an introduction.

Anyways let's get to my problem, which may very well have a simple solution that I keep overlooking..

I started writing a simple HTTP server a while ago, but over time I added bits and pieces of functionality. Right now I am trying to pass cookies from a CGI script (php, perl, etc) to the server, which will then send the Set-Cookie header to the client. Basically what I want to know is how does the cookie go from... say... the setcookie function in PHP to the header in the server.

I also would like to apologize if I posted in the wrong section. This is the only one which really looked feasible to me.

RedSon's Avatar
Site Moderator
 
Join Date: Jan 2007
Location: America
Posts: 3,393
#2: Oct 31 '08

re: HTTP and CGI


Maybe the HTML guys can help? If this is the wrong spot, someone ping me and I'll redirect it yet again.
Newbie
 
Join Date: Oct 2008
Posts: 5
#3: Oct 31 '08

re: HTTP and CGI


Has nothing to do with HTML at all really
This could apply with something as small as simple text output or perhaps binary output, depending on the script..

...Thanks for the reply though.

Let me try to re-explain...It's hard to follow my train of thought at times.
I can parse data from the server application to the CGI scripting application (ie perl) but I can not do the opposite (send data from the CGI scripting application to the server).

Basically I send information to the CGI program but I cannot find a way to have the CGI program send information (like cookies, headers, etc) to the server.
drhowarddrfine's Avatar
Expert
 
Join Date: Sep 2006
Posts: 5,573
#4: Oct 31 '08

re: HTTP and CGI


If you are writing your own server, then you do that with a print function to standard out which should be directed to the network. Just like you should start the header as "HTTP /1.1" and all that afterwards, in that header is the cookie information, such as "cookie: 12345-blah-blah-blah".

I don't know if I'm in the ballpark of the question.
Newbie
 
Join Date: Oct 2008
Posts: 5
#5: Oct 31 '08

re: HTTP and CGI


Quote:

Originally Posted by drhowarddrfine

If you are writing your own server, then you do that with a print function to standard out which should be directed to the network. Just like you should start the header as "HTTP /1.1" and all that afterwards, in that header is the cookie information, such as "cookie: 12345-blah-blah-blah".

I don't know if I'm in the ballpark of the question.

Pretty close...I already have the "cookie: 12345-blah-blah-blah" part down...What I need to do is get a CGI script to get the server to send specific headers such as "set-cookie: 12345-blah-blah-blah" if that makes any sense.
Expert
 
Join Date: Aug 2008
Posts: 397
#6: Oct 31 '08

re: HTTP and CGI


Quote:

Originally Posted by talcodes

Pretty close...I already have the "cookie: 12345-blah-blah-blah" part down...What I need to do is get a CGI script to get the server to send specific headers such as "set-cookie: 12345-blah-blah-blah" if that makes any sense.

Do you have an html/css question that you would like to resolve?
RedSon's Avatar
Site Moderator
 
Join Date: Jan 2007
Location: America
Posts: 3,393
#7: Oct 31 '08

re: HTTP and CGI


So you are using your own server instead of Apache or IIS?

We have some Apache experts to help you to config the server for cgi I could move this there.
Newbie
 
Join Date: Oct 2008
Posts: 5
#8: Nov 1 '08

re: HTTP and CGI


I could give the source code to my webserver if you like...this isn't an HTML/CSS question nor is it really an apache question, however an apache expert could possibly answer it.
Expert
 
Join Date: Aug 2008
Posts: 397
#9: Nov 1 '08

re: HTTP and CGI


Quote:

Originally Posted by RedSon

So you are using your own server instead of Apache or IIS?

We have some Apache experts to help you to config the server for cgi I could move this there.

Please move it. The OPs question has nothing to do with HTML/CSS afaik.
@RedSon
If you blink at me one more time, I will totally freak out, if not have a full-blown seizure.
Markus's Avatar
Moderator
 
Join Date: Jun 2007
Location: York, England, with wolves.
Posts: 4,948
#10: Nov 1 '08

re: HTTP and CGI


-- Moving.
Reply