Talk Root - PC Hardware, Software and Web Development forums

Go Back   Talk Root - PC Hardware, Software and Web Development forums > System Administration > Web Servers > IIS


Welcome to the Talk Root - PC Hardware, Software and Web Development forums. Are you a programmer, web developer, IT guy or a computer guru? We invite you to join our forums and participate in friendly discussion. It doesn't matter your skill level, we are here to help everyone.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.
Sponsored Links
Reply
 
LinkBack Thread Tools Rate Thread
Old 01-15-2004, 02:04 PM   #1
Patrick Germain
 
Posts: n/a
Cgi.exe with MFC or not ?

I wrote a simple cgi.exe program that returns a buffer to the client that
POSTed the request.
If I'm using plain C/C++, everything is OK.
But if I start using MFC classes, after a while, I get the infamous message
:

The specified CGI application misbehaved by not returning a complete set of
HTTP headers.

and the IIS server logs the error 502.2.
Is there any problem using MFC with an .exe ? If I use ISAPI, I don't have
the problem.


IIS is 6.0 and the OS is Win2003 server.
The Cgi code is

/////////////////////////////////
// ADD the statement CString AString ; AND YOU'LL GET AN ERROR 502.2 FROM
IIS
//
// The specified CGI application misbehaved by not returning a complete set
of HTTP headers.
//

CString AString ;

////////////////////////////////////////////////////////////////////////////
/

void main(int argc, char * argv[])

{
BYTE Buf[256] ;
for (int i = 0 ; i < 256 ; i++)
{
Buf[i] = (BYTE)i ;
}

_setmode (_fileno(stdout), _O_BINARY);
printf ("Content-Length: %u\r\n",sizeof (Buf)) ;
printf ("Content-type: application/octet-stream\r\n\r\n") ;
fwrite (Buf , 1 , sizeof (Buf), stdout) ;
}


 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
Reply


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -7. The time now is 04:59 PM.


Sponsors
Banner Best Deals 24x7 @ Geeks.com!
Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.0.0 RC8
vB Ad Management by =RedTyger=
© 2006 TalkRoot.com -