HTTP and CGI

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • talcodes
    New Member
    • Oct 2008
    • 5

    HTTP and CGI

    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
    Recognized Expert Expert
    • Jan 2007
    • 4980

    #2
    Maybe the HTML guys can help? If this is the wrong spot, someone ping me and I'll redirect it yet again.

    Comment

    • talcodes
      New Member
      • Oct 2008
      • 5

      #3
      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.

      Comment

      • drhowarddrfine
        Recognized Expert Expert
        • Sep 2006
        • 7434

        #4
        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.

        Comment

        • talcodes
          New Member
          • Oct 2008
          • 5

          #5
          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.

          Comment

          • David Laakso
            Recognized Expert Contributor
            • Aug 2008
            • 397

            #6
            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?

            Comment

            • RedSon
              Recognized Expert Expert
              • Jan 2007
              • 4980

              #7
              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.

              Comment

              • talcodes
                New Member
                • Oct 2008
                • 5

                #8
                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.

                Comment

                • David Laakso
                  Recognized Expert Contributor
                  • Aug 2008
                  • 397

                  #9
                  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.

                  Comment

                  • Markus
                    Recognized Expert Expert
                    • Jun 2007
                    • 6092

                    #10
                    -- Moving.

                    Comment

                    Working...