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

static void http_parse_multipart_query ( size_t  cnt_length,
rpl_c_str_t  boundary 
) [static]

Parses HTTP POST (MULTIPART) request (used for file uploads).

Parameters:
cnt_length 
boundary 

Definition at line 431 of file http.c.

References http_parse_multipart_string(), rpl_log_fatal(), rpl_me_malloc(), and rpl_message_get().

Referenced by rpl_http_parse_query().

                                                                    {
    rpl_str_t post_cnt;
    int l_pos;

    /* was >=0 but default type is unsigned so always true */
    assert((cnt_length > 0) && (boundary != NULL));

    /* +2 is required for the terminating character and the newline that fgets() sometimes stores */
    post_cnt = (rpl_str_t)rpl_me_malloc(cnt_length + 2);
    /* note: CGI does not stipulate use of the feof facility so cnt_length bytes must be read */
    if(fread(post_cnt, 1, cnt_length + 1, stdin) != cnt_length)
        rpl_log_fatal(rpl_message_get("PARSE_FORM_FAILED", RPL_EOM));


    /* if fgets() stores the terminating newline in the buffer then it is overwritten */
    l_pos = strlen(post_cnt) -1;
    if(post_cnt[l_pos] == '\n')
        post_cnt[l_pos] = '\0';

    http_parse_multipart_string(post_cnt, boundary);

}


Generated by  Doxygen 1.6.0   Back to index