Back to index

php5  5.3.10
Defines | Functions
php_content_types.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define DEFAULT_POST_CONTENT_TYPE   "application/x-www-form-urlencoded"

Functions

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

Define Documentation

#define DEFAULT_POST_CONTENT_TYPE   "application/x-www-form-urlencoded"

Definition at line 24 of file php_content_types.h.


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_HANDLER_FUNC ( php_std_post_handler  )

Definition at line 275 of file php_variables.c.

{
       char *var, *val, *e, *s, *p;
       zval *array_ptr = (zval *) arg;

       if (SG(request_info).post_data == NULL) {
              return;
       }      

       s = SG(request_info).post_data;
       e = s + SG(request_info).post_data_length;

       while (s < e && (p = memchr(s, '&', (e - s)))) {
last_value:
              if ((val = memchr(s, '=', (p - s)))) { /* have a value */
                     unsigned int val_len, new_val_len;

                     var = s;

                     php_url_decode(var, (val - s));
                     val++;
                     val_len = php_url_decode(val, (p - val));
                     val = estrndup(val, val_len);
                     if (sapi_module.input_filter(PARSE_POST, var, &val, val_len, &new_val_len TSRMLS_CC)) {
                            php_register_variable_safe(var, val, new_val_len, array_ptr TSRMLS_CC);
                     }
                     efree(val);
              }
              s = p + 1;
       }
       if (s < e) {
              p = e;
              goto last_value;
       }
}

Here is the call 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;
       }
}