Logo Search packages:      
Sourcecode: rapple version File versions  Download package

void rpl_http_parse_query ( void   ) 

Controls which parsing function is to be called (GET,POST +/- MULTIPART).

Definition at line 375 of file http.c.

References http_parse_get_query(), http_parse_multipart_query(), rpl_log_fatal(), and rpl_message_get().

                       {
    long int cnt_length;
    rpl_str_t cnt_length_str, cnt_type;

    /* check the request method and delegate as appropriate */
    if(strcmp(getenv("REQUEST_METHOD"),"POST") == 0) {
        cnt_length_str = getenv("CONTENT_LENGTH");
        if((cnt_length_str == NULL) || (strlen(cnt_length_str) == 0) || (sscanf(cnt_length_str, "%ld", &cnt_length) !=
                1))
            rpl_log_fatal(rpl_message_get("PARSE_FORM_FAILED", RPL_EOM));

        cnt_type = getenv("CONTENT_TYPE");
        if(strstr(cnt_type, RPL_HTTP_MTP_FORM_CONTENT_TYPE) != NULL) {
            http_parse_multipart_query(cnt_length, strstr(cnt_type, RPL_HTTP_MTP_FORM_BDY) + strlen(RPL_HTTP_MTP_FORM_BDY));
        } else {
            http_parse_form_enc_query(cnt_length);
        }
    } else if(strcmp(getenv("REQUEST_METHOD"),"GET") == 0) {
        http_parse_get_query();
    } else {
        rpl_log_fatal(rpl_message_get("UNSUPPORTED_METHOD", getenv("REQUEST_METHOD"), RPL_EOM));
    }
}


Generated by  Doxygen 1.6.0   Back to index