php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_content_types.c
Go to the documentation of this file.
1/*
2 +----------------------------------------------------------------------+
3 | Copyright (c) The PHP Group |
4 +----------------------------------------------------------------------+
5 | This source file is subject to version 3.01 of the PHP license, |
6 | that is bundled with this package in the file LICENSE, and is |
7 | available through the world-wide-web at the following url: |
8 | https://www.php.net/license/3_01.txt |
9 | If you did not receive a copy of the PHP license and are unable to |
10 | obtain it through the world-wide-web, please send a note to |
11 | license@php.net so we can mail you a copy immediately. |
12 +----------------------------------------------------------------------+
13 | Author: |
14 +----------------------------------------------------------------------+
15*/
16
17#include "php.h"
18#include "SAPI.h"
19#include "rfc1867.h"
20
21#include "php_content_types.h"
22
23/* {{{ php_post_entries[] */
24static const sapi_post_entry php_post_entries[] = {
25 { DEFAULT_POST_CONTENT_TYPE, sizeof(DEFAULT_POST_CONTENT_TYPE)-1, sapi_read_standard_form_data, php_std_post_handler },
26 { MULTIPART_CONTENT_TYPE, sizeof(MULTIPART_CONTENT_TYPE)-1, NULL, rfc1867_post_handler },
27 { NULL, 0, NULL, NULL }
28};
29/* }}} */
30
31/* {{{ SAPI_POST_READER_FUNC */
32SAPI_API SAPI_POST_READER_FUNC(php_default_post_reader)
33{
34 if (!strcmp(SG(request_info).request_method, "POST")) {
35 if (NULL == SG(request_info).post_entry) {
36 /* no post handler registered, so we just swallow the data */
37 sapi_read_standard_form_data();
38 }
39 }
40}
41/* }}} */
42
43/* {{{ php_startup_sapi_content_types */
45{
46 sapi_register_default_post_reader(php_default_post_reader);
47 sapi_register_treat_data(php_default_treat_data);
48 sapi_register_input_filter(php_default_input_filter, NULL);
49 return SUCCESS;
50}
51/* }}} */
52
53/* {{{ php_setup_sapi_content_types */
55{
56 sapi_register_post_entries(php_post_entries);
57
58 return SUCCESS;
59}
60/* }}} */
SAPI_API int sapi_register_default_post_reader(void(*default_post_reader)(void))
Definition SAPI.c:972
SAPI_API int sapi_register_treat_data(void(*treat_data)(int arg, char *str, zval *destArray))
Definition SAPI.c:982
SAPI_API int sapi_register_input_filter(unsigned int(*input_filter)(int arg, const char *var, char **val, size_t val_len, size_t *new_val_len), unsigned int(*input_filter_init)(void))
Definition SAPI.c:991
SAPI_API int sapi_register_post_entries(const sapi_post_entry *post_entries)
Definition SAPI.c:933
#define SAPI_POST_READER_FUNC(post_reader)
Definition SAPI.h:311
#define SG(v)
Definition SAPI.h:160
struct _sapi_post_entry sapi_post_entry
Definition SAPI.h:59
#define SAPI_API
Definition SAPI.h:39
#define NULL
Definition gdcache.h:45
#define SUCCESS
Definition hash_sha3.c:261
int php_startup_sapi_content_types(void)
int php_setup_sapi_content_types(void)
#define DEFAULT_POST_CONTENT_TYPE
#define MULTIPART_CONTENT_TYPE
Definition rfc1867.h:22
strcmp(string $string1, string $string2)