CGI Programming in C on Xitami Web Server

Discussion in 'C Programming' started by Don Blow, Jr., Jun 28, 2004.

  1. 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>Hello, 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><TITLE>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?
     
    Don Blow, Jr., Jun 28, 2004
    #1
    1. Advertising

  2. On Mon, 28 Jun 2004, Don Blow, Jr. wrote:
    >
    > I am running the simple program shown below (written in c):


    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
     
    Arthur J. O'Dwyer, Jun 29, 2004
    #2
    1. Advertising

  3. Don Blow, Jr.

    kal Guest

    "Arthur J. O'Dwyer" <> wrote in message news:<>...

    > <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><TITLE>CGI Output</TITLE></HEAD>
    <BODY>
    <H1>Hello, world.</H1>
    </BODY></HTML>

    That "Content-Type: text/html" line seems out of place to me.
     
    kal, Jun 29, 2004
    #3
  4. Don Blow, Jr.

    Default User Guest

    kal wrote:
    >
    > "Arthur J. O'Dwyer" <> wrote in message news:<>...
    >
    > > <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><TITLE>CGI Output</TITLE></HEAD>
    > <BODY>
    > <H1>Hello, world.</H1>
    > </BODY></HTML>
    >
    > That "Content-Type: text/html" line seems out of place to me.


    Why is that?




    Brian Rodenborn
     
    Default User, Jun 29, 2004
    #4
  5. On Tue, 29 Jun 2004, Default User wrote:
    >
    > kal wrote:
    > >
    > > "Arthur J. O'Dwyer" <> 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><TITLE>CGI Output</TITLE></HEAD>

    [...]
    > > 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.

    -Arthur,
    less baitfully
     
    Arthur J. O'Dwyer, Jun 30, 2004
    #5
  6. Don Blow, Jr.

    Default User Guest

    "Arthur J. O'Dwyer" wrote:
    >
    > On Tue, 29 Jun 2004, Default User wrote:
    > >
    > > kal wrote:
    > > >
    > > > "Arthur J. O'Dwyer" <> 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><TITLE>CGI Output</TITLE></HEAD>

    > [...]
    > > > 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.



    Brian Rodenborn
     
    Default User, Jun 30, 2004
    #6
  7. [OT] Re: CGI Programming in C on Xitami Web Server

    On Wed, 30 Jun 2004, Default User wrote:
    >
    > "Arthur J. O'Dwyer" wrote:
    > > On Tue, 29 Jun 2004, Default User wrote:
    > > > kal wrote:
    > > > > "Arthur J. O'Dwyer" <> 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.


    *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
     
    Arthur J. O'Dwyer, Jun 30, 2004
    #7
  8. Don Blow, Jr.

    Default User Guest

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

    "Arthur J. O'Dwyer" wrote:
    >
    > On Wed, 30 Jun 2004, Default User wrote:
    > >
    > > "Arthur J. O'Dwyer" wrote:
    > > > On Tue, 29 Jun 2004, Default User wrote:
    > > > > kal wrote:
    > > > > > "Arthur J. O'Dwyer" <> 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.

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



    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
     
    Default User, Jun 30, 2004
    #8
  9. Re: [OT] Re: CGI Programming in C on Xitami Web Server

    On Wed, 30 Jun 2004, Default User wrote:
    >
    > "Arthur J. O'Dwyer" wrote:
    > > On Wed, 30 Jun 2004, Default User wrote:
    > > > "Arthur J. O'Dwyer" wrote:
    > > > > On Tue, 29 Jun 2004, Default User wrote:
    > > > > > kal wrote:
    > > > > > > "Arthur J. O'Dwyer" <> 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.

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

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


    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
     
    Arthur J. O'Dwyer, Jul 1, 2004
    #9
  10. Don Blow, Jr.

    Default User Guest

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

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


    Ok.

    > * 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..."


    Yes.

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


    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.

    > * 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).


    Well, I didn't get much tongue-in-cheek from it.

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

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


    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.

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


    Why am I supposed to get your jokes when you don't get mine? I explained
    mine to you as well.

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


    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
     
    Default User, Jul 1, 2004
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Fuzzyman

    CGI Problems With Xitami

    Fuzzyman, Apr 8, 2004, in forum: Python
    Replies:
    7
    Views:
    544
    Fuzzyman
    Apr 14, 2004
  2. John Bradbury

    lrwp + xitami

    John Bradbury, Nov 2, 2004, in forum: Python
    Replies:
    0
    Views:
    400
    John Bradbury
    Nov 2, 2004
  3. excord80
    Replies:
    17
    Views:
    693
    J Kenneth King
    Jan 29, 2009
  4. kath
    Replies:
    4
    Views:
    648
    J. Gleixner
    Apr 9, 2007
  5. PerlFAQ Server
    Replies:
    0
    Views:
    132
    PerlFAQ Server
    Mar 31, 2011
Loading...

Share This Page