Changeset 279

Show
Ignore:
Timestamp:
06/02/10 08:09:32 (20 months ago)
Author:
ol
Message:

Fix FastCGI exit handle. Improve log output. Null query check on top

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/ows/ows.c

    r278 r279  
    275275    /* GET could only handle KVP */ 
    276276    if (cgi_method_get()) o->request->method = OWS_METHOD_KVP; 
     277 
    277278    /* POST could handle KVP or XML encoding */ 
    278279    else if (cgi_method_post()) { 
     
    289290                 !strcmp(getenv("CONTENT_TYPE"), "text/plain")) 
    290291            o->request->method = OWS_METHOD_XML; 
     292 
    291293        /* Command line Unit Test cases with XML values (not HTTP) */ 
    292294    } else if (!cgi_method_post() && !cgi_method_get() && query[0] == '<') 
     
    294296    else if (!cgi_method_post() && !cgi_method_get()) 
    295297        o->request->method = OWS_METHOD_KVP; 
     298 
    296299    else ows_error(o, OWS_ERROR_REQUEST_HTTP, "Wrong HTTP request Method", "http"); 
    297300 
     
    334337    if (!o->exit) query = cgi_getback_query(o); 
    335338 
    336     /* Usage or Version command line options */ 
    337339    if (query == NULL || strlen(query) == 0) { 
     340 
     341        /* Usage or Version command line options */ 
    338342        if (argc > 1) { 
    339343 
     
    349353                else ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE, 
    350354                             "Service Unknown", "service"); 
    351  
    352355                o->exit = true; 
    353         } 
     356 
     357        } else { 
     358                ows_error(o, OWS_ERROR_INVALID_PARAMETER_VALUE,  
     359                             "Service Unknown", "service"); 
     360                o->exit = true; 
     361        } 
    354362    }  
    355363 
    356  
    357364    /* Log input query if asked */ 
    358    if (o->log != NULL) 
    359         fprintf(o->log, "[QUERY]\n%s\n---\n", query); 
    360  
    361     o->request = ows_request_init(); 
     365   if (o->log && query) 
     366        fprintf(o->log, "[QUERY]\n%s\n", query); 
     367 
     368    if (!o->exit) o->request = ows_request_init(); 
    362369    if (!o->exit) ows_kvp_or_xml(o, query); 
    363370 
     
    405412 
    406413#if TINYOWS_FCGI 
    407     }  
     414    if (o->log) fprintf(o->log, "---\n");  
     415    o->exit = false; 
     416    } 
     417    if (o->log) fprintf(o->log, "== FCGI SHUTDOWN == \n"); 
    408418    OS_LibShutdown(); 
    409419#endif