Changeset 508 for trunk/gsdl/src/recpt


Ignore:
Timestamp:
1999-09-02T12:24:36+12:00 (25 years ago)
Author:
rjmcnab
Message:

fixed bug in getting POST arguments

File:
1 edited

Legend:

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

    r465 r508  
    1212/*
    1313   $Log$
     14   Revision 1.19  1999/09/02 00:24:36  rjmcnab
     15   fixed bug in getting POST arguments
     16
    1417   Revision 1.18  1999/08/20 01:02:07  sjboddie
    1518   added some usage logging
     
    9699#include "recptconfig.h"
    97100#include <stdlib.h>
     101
     102
     103// get GSDL_GSDLHOME
     104#include "gsdlhome.h"
    98105
    99106
     
    112119#include "fcgiapp.h"
    113120#endif
    114 
    115 
    116 // Note: site.h would not be needed if we could
    117 // dynamically find out gsdlhome.
    118 #include "site.h"
    119121
    120122
     
    408410    char *content_length_str = getenv("CONTENT_LENGTH");
    409411    if (request_method_str != NULL && strcmp(request_method_str, "POST") == 0 &&
    410     content_length_str != NULL) {
     412    content_length_str != NULL)  {
    411413      // POST form data
    412414      int content_length = text_t(content_length_str).getint();
    413       char c;
    414       cin.get(c);
    415       while (content_length > 0 && !cin.eof()) {
    416     argstr.push_back (c);
    417     content_length--;
    418     cin.get(c);
     415      if (content_length > 0) {
     416    char c;
     417    do {
     418      cin.get(c);
     419      if (cin.eof()) break;
     420      argstr.push_back (c);
     421      content_length--;
     422    } while (content_length > 0);
    419423      }
    420424     
    421425    } else {
    422426      aURIStr = getenv("QUERY_STRING");
    423       if (aURIStr != NULL) {
     427      if ((request_method_str != NULL && strcmp(request_method_str, "GET") == 0)
     428      || aURIStr != NULL) {
    424429    // GET form data
    425     argstr = aURIStr;
     430    if (aURIStr != NULL) argstr = aURIStr;
    426431      } else {
    427432    // debugging from command line
Note: See TracChangeset for help on using the changeset viewer.