Changeset 365


Ignore:
Timestamp:
1999-07-11T13:03:37+12:00 (25 years ago)
Author:
rjmcnab
Message:

Added ability to receive POST cgi form data.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/src/recpt/cgiwrapper.cpp

    r284 r365  
    1212/*
    1313   $Log$
     14   Revision 1.14  1999/07/11 01:03:37  rjmcnab
     15   Added ability to receive POST cgi form data.
     16
    1417   Revision 1.13  1999/06/24 05:12:18  sjboddie
    1518   lots of small changes
     
    413416  char *aURIStr;
    414417  if (!isfastcgi) {
    415     aURIStr = getenv("QUERY_STRING");
    416     if (aURIStr != NULL) argstr = aURIStr;
    417     else {
    418       char cinURIStr[1024];
    419       cin >> cinURIStr;
    420       argstr = cinURIStr;
    421     }
     418    char *request_method_str = getenv("REQUEST_METHOD");
     419    char *content_length_str = getenv("CONTENT_LENGTH");
     420    if (request_method_str != NULL && strcmp(request_method_str, "POST") == 0 &&
     421    content_length_str != NULL) {
     422      // POST form data
     423      int content_length = text_t(content_length).getint();
     424      char c;
     425      cin.get(c);
     426      while (content_length > 0 && !cin.eof()) {
     427    argstr.push_back (c);
     428    content_length--;
     429    cin.get(c);
     430      }
     431     
     432    } else {
     433      aURIStr = getenv("QUERY_STRING");
     434      if (aURIStr != NULL) {
     435    // GET form data
     436    argstr = aURIStr;
     437      } else {
     438    // debugging from command line
     439    char cinURIStr[1024];
     440    cin.get(cinURIStr, 1024);
     441    argstr = cinURIStr;
     442      }
     443    }
     444
     445    // cgi scripts only deal with one request
    422446    maxrequests = 1;
    423447  }
Note: See TracChangeset for help on using the changeset viewer.