Back to index

php5  5.3.10
Functions | Variables
php_content_types.c File Reference
#include "php.h"
#include "SAPI.h"
#include "rfc1867.h"
#include "php_content_types.h"

Go to the source code of this file.

Functions

SAPI_API SAPI_POST_READER_FUNC (php_default_post_reader)
int php_startup_sapi_content_types (TSRMLS_D)
int php_setup_sapi_content_types (TSRMLS_D)

Variables

static sapi_post_entry php_post_entries []

Function Documentation

Definition at line 85 of file php_content_types.c.

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 74 of file php_content_types.c.

{
       sapi_register_default_post_reader(php_default_post_reader);
       sapi_register_treat_data(php_default_treat_data);
       sapi_register_input_filter(php_default_input_filter, NULL);
       return SUCCESS;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SAPI_API SAPI_POST_READER_FUNC ( php_default_post_reader  )

Definition at line 38 of file php_content_types.c.

{
       char *data;
       int length;

       /* $HTTP_RAW_POST_DATA registration */
       if (!strcmp(SG(request_info).request_method, "POST")) {
              if (NULL == SG(request_info).post_entry) {
                     /* no post handler registered, so we just swallow the data */
                     sapi_read_standard_form_data(TSRMLS_C);
              }

              /* For unknown content types we create HTTP_RAW_POST_DATA even if always_populate_raw_post_data off,
               * this is in-effecient, but we need to keep doing it for BC reasons (for now) */
              if ((PG(always_populate_raw_post_data) || NULL == SG(request_info).post_entry) && SG(request_info).post_data) {
                     length = SG(request_info).post_data_length;
                     data = estrndup(SG(request_info).post_data, length);
                     SET_VAR_STRINGL("HTTP_RAW_POST_DATA", data, length);
              }
       }

       /* for php://input stream:
        some post handlers modify the content of request_info.post_data
        so for now we need a copy for the php://input stream
        in the long run post handlers should be changed to not touch
        request_info.post_data for memory preservation reasons
       */
       if (SG(request_info).post_data) {
              SG(request_info).raw_post_data = estrndup(SG(request_info).post_data, SG(request_info).post_data_length);
              SG(request_info).raw_post_data_length = SG(request_info).post_data_length;
       }
}

Variable Documentation

sapi_post_entry php_post_entries[] [static]
Initial value:
 {
       { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data,   php_std_post_handler },
       { MULTIPART_CONTENT_TYPE,    sizeof(MULTIPART_CONTENT_TYPE)-1,    NULL,                         rfc1867_post_handler },
       { NULL, 0, NULL, NULL }
}

Definition at line 29 of file php_content_types.c.