CGI Programming in C on Xitami Web Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Don Blow, Jr.

    #1

    CGI Programming in C on Xitami Web Server

    I am running the simple program shown below (written in c):

    -----------------------------------------------------------------------

    #include <stdio.h>
    #include <stdlib.h>



    int main(int argc, char *argv[])
    {
    printf("Content-Type: text/html\n\n");


    printf("<HTML>< HEAD><TITLE>CGI Output</TITLE></HEAD>\n");
    printf("<BODY>\ n");
    printf("<H1>Hel lo, world.</H1>\n");
    printf("</BODY></HTML>\n");

    return 0;
    }

    -----------------------------------------------------------------------

    When I compile this program and run it on a webpage through the Xitami
    server

    I get a blank page. When I run it in a DOS command prompt window I get the
    following:

    -----------------------------------------------------------------------

    Content-Type: text/html



    <HTML><HEAD><TI TLE>CGI Output</TITLE></HEAD>
    <BODY>
    <H1>Hello, world.</H1>
    </BODY></HTML>



    C:\Xitami\cgi-bin>
    C:\Xitami\cgi-bin>
    C:\Xitami\cgi-bin>

    -----------------------------------------------------------------------

    This looks right to me. I have used the xitami server with CGI before and it
    gave

    me no problems, but now all I get is a blank page when I run any cgi
    program. I don't

    know if it is my programming syntax or a config issue or what. Has anyone
    had this

    problem before too and can anyone identify what the issue here is?



  • Arthur J. O'Dwyer

    #2
    Re: CGI Programming in C on Xitami Web Server


    On Mon, 28 Jun 2004, Don Blow, Jr. wrote:[color=blue]
    >
    > I am running the simple program shown below (written in c):[/color]

    There is nothing wrong with your C program. Thus your problem
    is off-topic here. (Your *post* was perfectly on-topic, but now
    that we've established that your C is correct, you'll have to
    look elsewhere for answers to your real problem.)

    <OT> The HTTP and HTML look good to me, too, at a first glance.
    I think you probably have a configuration problem; read the Xitami
    docs and check Google. </OT>

    -Arthur

    Comment

    • kal

      #3
      Re: CGI Programming in C on Xitami Web Server

      "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.58-035.04062821030 60.12303@unix46 .andrew.cmu.edu >...
      [color=blue]
      > <OT> The HTTP and HTML look good to me, too, at a first glance.
      > I think you probably have a configuration problem; read the Xitami
      > docs and check Google. </OT>[/color]

      Content-Type: text/html
      <HTML><HEAD><TI TLE>CGI Output</TITLE></HEAD>
      <BODY>
      <H1>Hello, world.</H1>
      </BODY></HTML>

      That "Content-Type: text/html" line seems out of place to me.

      Comment

      • Default User

        #4
        Re: CGI Programming in C on Xitami Web Server

        kal wrote:[color=blue]
        >
        > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote in message news:<Pine.LNX. 4.58-035.04062821030 60.12303@unix46 .andrew.cmu.edu >...
        >[color=green]
        > > <OT> The HTTP and HTML look good to me, too, at a first glance.
        > > I think you probably have a configuration problem; read the Xitami
        > > docs and check Google. </OT>[/color]
        >
        > Content-Type: text/html
        > <HTML><HEAD><TI TLE>CGI Output</TITLE></HEAD>
        > <BODY>
        > <H1>Hello, world.</H1>
        > </BODY></HTML>
        >
        > That "Content-Type: text/html" line seems out of place to me.[/color]

        Why is that?




        Brian Rodenborn

        Comment

        • Arthur J. O'Dwyer

          #5
          Re: CGI Programming in C on Xitami Web Server


          On Tue, 29 Jun 2004, Default User wrote:[color=blue]
          >
          > kal wrote:[color=green]
          > >
          > > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote[color=darkred]
          > > > <OT> The HTTP and HTML look good to me, too, at a first glance.
          > > > I think you probably have a configuration problem; read the Xitami
          > > > docs and check Google. </OT>[/color]
          > >
          > > Content-Type: text/html
          > > <HTML><HEAD><TI TLE>CGI Output</TITLE></HEAD>[/color][/color]
          [...][color=blue][color=green]
          > > That "Content-Type: text/html" line seems out of place to me.[/color]
          >
          > Why is that?[/color]

          Because here in comp.lang.c, we don't discuss Content-Type headers.
          Thus, it (and any further discussion of HTTP and related protocols)
          is out of place here.

          -Arthur,
          less baitfully

          Comment

          • Default User

            #6
            Re: CGI Programming in C on Xitami Web Server

            "Arthur J. O'Dwyer" wrote:[color=blue]
            >
            > On Tue, 29 Jun 2004, Default User wrote:[color=green]
            > >
            > > kal wrote:[color=darkred]
            > > >
            > > > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote
            > > > > <OT> The HTTP and HTML look good to me, too, at a first glance.
            > > > > I think you probably have a configuration problem; read the Xitami
            > > > > docs and check Google. </OT>
            > > >
            > > > Content-Type: text/html
            > > > <HTML><HEAD><TI TLE>CGI Output</TITLE></HEAD>[/color][/color]
            > [...][color=green][color=darkred]
            > > > That "Content-Type: text/html" line seems out of place to me.[/color]
            > >
            > > Why is that?[/color]
            >
            > Because here in comp.lang.c, we don't discuss Content-Type headers.
            > Thus, it (and any further discussion of HTTP and related protocols)
            > is out of place here.[/color]


            I didn't say anything about CGI protocols. From looking at the code, the
            line seemed to be in the right place, although I'd expect another new
            line following it. But it definitely did not look out of place.



            Brian Rodenborn

            Comment

            • Arthur J. O'Dwyer

              #7
              [OT] Re: CGI Programming in C on Xitami Web Server


              On Wed, 30 Jun 2004, Default User wrote:[color=blue]
              >
              > "Arthur J. O'Dwyer" wrote:[color=green]
              > > On Tue, 29 Jun 2004, Default User wrote:[color=darkred]
              > > > kal wrote:
              > > > > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote
              > > > > > <OT> The HTTP and HTML look good to me, too, at a first glance.
              > > > >
              > > > > Content-Type: text/html[/color]
              > > [...][color=darkred]
              > > > > That "Content-Type: text/html" line seems out of place to me.
              > > >
              > > > Why is that?[/color]
              > >
              > > Because here in comp.lang.c, we don't discuss Content-Type headers.
              > > Thus, it (and any further discussion of HTTP and related protocols)
              > > is out of place here.[/color]
              >
              > I didn't say anything about CGI protocols. From looking at the code, the
              > line seemed to be in the right place, although I'd expect another new
              > line following it. But it definitely did not look out of place.[/color]

              *sigh* "The HTTP and HTML look good to me." That means THEY ARE
              FINE; kal is wrong; this whole discussion is not topical here; I
              explained *all* this in my original post; the OP has gone to look for
              configuration answers elsewhere. Posting to comp.lang.c saying, "gee,
              this HTTP looks right to me" is useless. If you think it's *not* right,
              then find a tutorial and read it --- not here! If you think it *is*
              right, then be quiet, because you won't add anything with "me-too"
              posts.

              HTH,
              -Arthur

              Comment

              • Default User

                #8
                Re: [OT] Re: CGI Programming in C on Xitami Web Server

                "Arthur J. O'Dwyer" wrote:[color=blue]
                >
                > On Wed, 30 Jun 2004, Default User wrote:[color=green]
                > >
                > > "Arthur J. O'Dwyer" wrote:[color=darkred]
                > > > On Tue, 29 Jun 2004, Default User wrote:
                > > > > kal wrote:
                > > > > > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote
                > > > > > > <OT> The HTTP and HTML look good to me, too, at a first glance.
                > > > > >
                > > > > > Content-Type: text/html
                > > > [...]
                > > > > > That "Content-Type: text/html" line seems out of place to me.
                > > > >
                > > > > Why is that?
                > > >
                > > > Because here in comp.lang.c, we don't discuss Content-Type headers.
                > > > Thus, it (and any further discussion of HTTP and related protocols)
                > > > is out of place here.[/color]
                > >
                > > I didn't say anything about CGI protocols. From looking at the code, the
                > > line seemed to be in the right place, although I'd expect another new
                > > line following it. But it definitely did not look out of place.[/color]
                >
                > *sigh* "The HTTP and HTML look good to me." That means THEY ARE
                > FINE; kal is wrong; this whole discussion is not topical here; I
                > explained *all* this in my original post; the OP has gone to look for
                > configuration answers elsewhere. Posting to comp.lang.c saying, "gee,
                > this HTTP looks right to me" is useless. If you think it's *not* right,
                > then find a tutorial and read it --- not here! If you think it *is*
                > right, then be quiet, because you won't add anything with "me-too"
                > posts.[/color]


                I DIDN'T POST THAT! Go reread, and reread for comprehension.

                Please confine your comments to what I a actually said, not what others
                said and that you have mistakenly attributed to me. I posted a one-line
                question in reference to the comment:

                "That "Content-Type: text/html" line seems out of place to me."


                Feel free to apologize for your rude behavior.



                Brian Rodenborn

                Comment

                • Arthur J. O'Dwyer

                  #9
                  Re: [OT] Re: CGI Programming in C on Xitami Web Server


                  On Wed, 30 Jun 2004, Default User wrote:[color=blue]
                  >
                  > "Arthur J. O'Dwyer" wrote:[color=green]
                  > > On Wed, 30 Jun 2004, Default User wrote:[color=darkred]
                  > > > "Arthur J. O'Dwyer" wrote:
                  > > > > On Tue, 29 Jun 2004, Default User wrote:
                  > > > > > kal wrote:
                  > > > > > > "Arthur J. O'Dwyer" <ajo@nospam.and rew.cmu.edu> wrote
                  > > > > > > > <OT> The HTTP and HTML look good to me, too, at a first glance.
                  > > > > > >
                  > > > > > > Content-Type: text/html
                  > > > > [...]
                  > > > > > > That "Content-Type: text/html" line seems out of place to me.
                  > > > > >
                  > > > > > Why is that?
                  > > > >
                  > > > > Because here in comp.lang.c, we don't discuss Content-Type headers.
                  > > > > Thus, it (and any further discussion of HTTP and related protocols)
                  > > > > is out of place here.
                  > > >
                  > > > I didn't say anything about CGI protocols. From looking at the code, the
                  > > > line seemed to be in the right place, although I'd expect another new
                  > > > line following it. But it definitely did not look out of place.[/color]
                  > >
                  > > *sigh* "The HTTP and HTML look good to me." That means THEY ARE
                  > > FINE; kal is wrong; this whole discussion is not topical here; I
                  > > explained *all* this in my original post; the OP has gone to look for
                  > > configuration answers elsewhere. Posting to comp.lang.c saying, "gee,
                  > > this HTTP looks right to me" is useless. If you think it's *not* right,
                  > > then find a tutorial and read it --- not here! If you think it *is*
                  > > right, then be quiet, because you won't add anything with "me-too"
                  > > posts.[/color]
                  >
                  > I DIDN'T POST THAT! Go reread, and reread for comprehension.
                  >
                  > Please confine your comments to what I a actually said, not what others
                  > said and that you have mistakenly attributed to me. I posted a one-line
                  > question in reference to the comment:
                  >
                  > "That "Content-Type: text/html" line seems out of place to me."
                  >
                  > Feel free to apologize for your rude behavior.[/color]

                  Well, I apologize if I misinterpreted your comment, but here's what
                  I saw:

                  * The OP posts a query about C and HTTP.
                  * I answer the C part, and point out that the HTTP part is also fine.
                  * kal says, "That 'Content-Type: ...' line seems out of place..."
                  * You (Brian) say, "Why is that?", which I gather to mean you either
                  honestly don't know HTTP and want to start a conversation about
                  it in comp.lang.c, or else you know kal is wrong and are just
                  yanking his/her chain.
                  * I respond, tongue-in-cheek, that the line is out-of-place because
                  here in comp.lang.c we do not discuss HTTP, and further discussion
                  ought to be taken elsewhere (as I'd already said, three messages
                  upthread).
                  * You respond, seemingly with a straight face, that you *still*
                  don't see anything wrong with the HTTP, and imply that you still
                  want to keep talking about HTTP in comp.lang.c.
                  * I reply to you, explaining the joke, and explaining *explicitly*
                  that HTTP is not and has never been topical here. I acknowledge
                  that maybe you know HTTP, in which case you have nothing to worry
                  about, or maybe you don't, in which case you should read a tutorial
                  if you're interested.
                  * You take offense, apparently because you think *I* think you were
                  the OP (or maybe kal, I'm not sure). You seem to know that HTTP
                  is not topical here.
                  [So stop trying to talk about it.]

                  It ought to satisfy you that I say kal was wrong, the OP and I were
                  right. If not, you're welcome to read a book on your own. I'm going
                  back to C programming now.

                  -Arthur,
                  signing off

                  Comment

                  • Default User

                    #10
                    Re: [OT] Re: CGI Programming in C on Xitami Web Server

                    "Arthur J. O'Dwyer" wrote:[color=blue]
                    > Well, I apologize if I misinterpreted your comment, but here's what
                    > I saw:
                    >
                    > * The OP posts a query about C and HTTP.[/color]

                    Ok.
                    [color=blue]
                    > * I answer the C part, and point out that the HTTP part is also fine.
                    > * kal says, "That 'Content-Type: ...' line seems out of place..."[/color]

                    Yes.
                    [color=blue]
                    > * You (Brian) say, "Why is that?", which I gather to mean you either
                    > honestly don't know HTTP and want to start a conversation about
                    > it in comp.lang.c, or else you know kal is wrong and are just
                    > yanking his/her chain.[/color]

                    You're saying my commentary was vague. Fair enough. There was obviously
                    a third explanation, I could have been yanking his chain in an on-topic
                    manner. "Out of place" can have multiple meanings, one being "doesn't
                    belong" another being "in the wrong location". The output as a result of
                    the perfectly topical C program shown, looked good excepting the other
                    newline I expected, but of course the standard has nothing to say about
                    what an implementation must do with a newline. That's a QOI issue.
                    [color=blue]
                    > * I respond, tongue-in-cheek, that the line is out-of-place because
                    > here in comp.lang.c we do not discuss HTTP, and further discussion
                    > ought to be taken elsewhere (as I'd already said, three messages
                    > upthread).[/color]

                    Well, I didn't get much tongue-in-cheek from it.
                    [color=blue]
                    > * You respond, seemingly with a straight face, that you *still*
                    > don't see anything wrong with the HTTP, and imply that you still
                    > want to keep talking about HTTP in comp.lang.c.[/color]

                    I didn't comment on the HTTP. I commented on the text output, it could
                    have been "Mary Had a Little Lamb" for all I cared. This was my
                    objection, you assigning things to me that I didn't say.
                    [color=blue]
                    > * I reply to you, explaining the joke, and explaining *explicitly*
                    > that HTTP is not and has never been topical here. I acknowledge
                    > that maybe you know HTTP, in which case you have nothing to worry
                    > about, or maybe you don't, in which case you should read a tutorial
                    > if you're interested.[/color]

                    Whether I know HTTP or CGI or anything else is beside the point, as I
                    already told you, because I wasn't commenting on it.
                    [color=blue]
                    > * You take offense, apparently because you think *I* think you were
                    > the OP (or maybe kal, I'm not sure). You seem to know that HTTP
                    > is not topical here.[/color]

                    Why am I supposed to get your jokes when you don't get mine? I explained
                    mine to you as well.
                    [color=blue]
                    > It ought to satisfy you that I say kal was wrong, the OP and I were
                    > right. If not, you're welcome to read a book on your own. I'm going
                    > back to C programming now.[/color]

                    I haven't the slightest care (in this newsgroup) whether that was a
                    proper response header or not. I care about the output from the program.


                    I hope you understand now that what annoyed me was you claiming (and did
                    it again in this post) that I said things I didn't. Read carefully what
                    exactly I said at each point.




                    Brian Rodenborn

                    Comment

                    Working...