Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > cgi post - clear data from stdin

Reply
Thread Tools

cgi post - clear data from stdin

 
 
Oliver Bleckmann
Guest
Posts: n/a
 
      11-28-2006
hey guys,
i have a little problem. my cgi routines are working so far,
but i need to redirect to the cgi-programm and what the
"posted" data to be cleared if redirected. i don't know
how the post method exactly works. maybe i have to
clear the stdin (tried fflush)!? maybe the is another reason
that the former data is displayed. fist i thought of the browser
cach, but it's the same problem using ctrl+f5.
i need to check if the cgi program is called with form data
or not, because checking the request method does not work either.
any ideas?

code:

.....
std::string meth_s = null_to_empty(std::getenv("REQUEST_METHOD"));
if (meth_s == "")
{
cout << "EMPTY" << endl;
// code in case no data is passed, doesn't work, because
of the persistent post data and
// it seems, that every url call ist a "get" command !?
}
else if (meth_s == "GET")
{
query = null_to_empty(getenv("QUERY_STRING"));
cout << "GET" << endl;
cout << query << endl;
} else if (meth_s == "POST")
{
// This is the routine for the query string, which
should be parsed and cleared on every program call, but remains even on a
ctrl+f5 refresh
int len = atoi(getenv("CONTENT_LENGTH"));
input = new char[len+1];
fread(input, 1, len, stdin);
input[len] = 0;
cout << "POST" << endl;
query = input;
cout << query << endl;
delete input;
//fflush ( stdin );
} else cout << "NONE" << endl;
.......


 
Reply With Quote
 
 
 
Reply

Thread Tools

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
peek at stdin, flush stdin Johnathan Doe C Programming 5 5 Days Ago 04:30 PM
How to pass stdin of a C++ program to the stdin of a process createdwith ShellExecute() Ben C Programming 2 08-29-2009 09:47 PM
STDIN, OUT, ERR and $stdin, out, err - Differences? Terry Cooper Ruby 7 06-09-2009 05:48 AM
Reading from stdin then launching a program that reads from stdin strange behaviour Stefano Sabatini Perl Misc 6 07-29-2007 10:38 PM
Reading stdin once confuses second stdin read Charlie Zender C Programming 6 06-21-2004 01:39 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57