CGI Programming in C on Xitami Web Server

D

Don Blow, Jr.

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?
 
A

Arthur J. O'Dwyer

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
 
K

kal

Arthur J. O'Dwyer said:
<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.
 
D

Default User

kal said:
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
 
A

Arthur J. O'Dwyer

Arthur J. O'Dwyer said:
<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
 
D

Default User

Arthur J. O'Dwyer said:
<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
 
A

Arthur J. O'Dwyer

Arthur J. O'Dwyer said:
kal 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
 
D

Default User

Arthur J. O'Dwyer said:
Arthur J. O'Dwyer said:
<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
 
A

Arthur J. O'Dwyer

Arthur J. O'Dwyer said:
:
<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
 
D

Default User

Arthur J. O'Dwyer said:
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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top