php-internal-docs 8.4.8
Unofficial docs for php/php-src
Loading...
Searching...
No Matches
php_http_parser.c File Reference
#include <assert.h>
#include <stddef.h>
#include "php_http_parser.h"

Go to the source code of this file.

Macros

#define MIN(a, b)
 
#define CALLBACK2(FOR)
 
#define MARK(FOR)
 
#define CALLBACK_NOCLEAR(FOR)
 
#define CALLBACK(FOR)
 
#define PROXY_CONNECTION   "proxy-connection"
 
#define CONNECTION   "connection"
 
#define CONTENT_LENGTH   "content-length"
 
#define TRANSFER_ENCODING   "transfer-encoding"
 
#define UPGRADE   "upgrade"
 
#define CHUNKED   "chunked"
 
#define KEEP_ALIVE   "keep-alive"
 
#define CLOSE   "close"
 
#define PARSING_HEADER(state)
 
#define CR   '\r'
 
#define LF   '\n'
 
#define LOWER(c)
 
#define TOKEN(c)
 
#define start_state   (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)
 
#define STRICT_CHECK(cond)
 
#define NEW_MESSAGE()
 

Enumerations

enum  header_states {
  h_general = 0 , h_C , h_CO , h_CON ,
  h_matching_connection , h_matching_proxy_connection , h_matching_content_length , h_matching_transfer_encoding ,
  h_matching_upgrade , h_connection , h_content_length , h_transfer_encoding ,
  h_upgrade , h_matching_transfer_encoding_chunked , h_matching_connection_keep_alive , h_matching_connection_close ,
  h_transfer_encoding_chunked , h_connection_keep_alive , h_connection_close
}
 
enum  flags {
  F_CHUNKED = 1 << 0 , F_CONNECTION_KEEP_ALIVE = 1 << 1 , F_CONNECTION_CLOSE = 1 << 2 , F_TRAILING = 1 << 3 ,
  F_UPGRADE = 1 << 4 , F_SKIPBODY = 1 << 5
}
 

Functions

size_t php_http_parser_execute (php_http_parser *parser, const php_http_parser_settings *settings, const char *data, size_t len)
 
int php_http_should_keep_alive (php_http_parser *parser)
 
const char * php_http_method_str (enum php_http_method m)
 
void php_http_parser_init (php_http_parser *parser, enum php_http_parser_type t)
 

Macro Definition Documentation

◆ CALLBACK

#define CALLBACK ( FOR)
Value:
do { \
CALLBACK_NOCLEAR(FOR); \
FOR##_mark = NULL; \
} while (0)
#define NULL
Definition gdcache.h:45

Definition at line 61 of file php_http_parser.c.

◆ CALLBACK2

#define CALLBACK2 ( FOR)
Value:
do { \
if (settings->on_##FOR) { \
if (0 != settings->on_##FOR(parser)) return (p - data); \
} \
} while (0)
zend_constant * data
p
Definition session.c:1105

Definition at line 31 of file php_http_parser.c.

◆ CALLBACK_NOCLEAR

#define CALLBACK_NOCLEAR ( FOR)
Value:
do { \
if (FOR##_mark) { \
if (settings->on_##FOR) { \
if (0 != settings->on_##FOR(parser, \
FOR##_mark, \
p - FOR##_mark)) \
{ \
return (p - data); \
} \
} \
} \
} while (0)

Definition at line 44 of file php_http_parser.c.

◆ CHUNKED

#define CHUNKED   "chunked"

Definition at line 73 of file php_http_parser.c.

◆ CLOSE

#define CLOSE   "close"

Definition at line 75 of file php_http_parser.c.

◆ CONNECTION

#define CONNECTION   "connection"

Definition at line 69 of file php_http_parser.c.

◆ CONTENT_LENGTH

#define CONTENT_LENGTH   "content-length"

Definition at line 70 of file php_http_parser.c.

◆ CR

#define CR   '\r'

Definition at line 238 of file php_http_parser.c.

◆ KEEP_ALIVE

#define KEEP_ALIVE   "keep-alive"

Definition at line 74 of file php_http_parser.c.

◆ LF

#define LF   '\n'

Definition at line 239 of file php_http_parser.c.

◆ LOWER

#define LOWER ( c)
Value:
(unsigned char)(c | 0x20)

Definition at line 240 of file php_http_parser.c.

◆ MARK

#define MARK ( FOR)
Value:
do { \
FOR##_mark = p; \
} while (0)

Definition at line 39 of file php_http_parser.c.

◆ MIN

#define MIN ( a,
b )
Value:
((a) < (b) ? (a) : (b))
$obj a
Definition test.php:84

Definition at line 27 of file php_http_parser.c.

◆ NEW_MESSAGE

#define NEW_MESSAGE ( )
Value:
#define start_state

Definition at line 252 of file php_http_parser.c.

◆ PARSING_HEADER

#define PARSING_HEADER ( state)
Value:
(state <= s_headers_almost_done && 0 == (parser->flags & F_TRAILING))
@ F_TRAILING
@ s_headers_almost_done

Definition at line 198 of file php_http_parser.c.

◆ PROXY_CONNECTION

#define PROXY_CONNECTION   "proxy-connection"

Definition at line 68 of file php_http_parser.c.

◆ start_state

#define start_state   (parser->type == PHP_HTTP_REQUEST ? s_start_req : s_start_res)

Definition at line 244 of file php_http_parser.c.

◆ STRICT_CHECK

#define STRICT_CHECK ( cond)

Definition at line 251 of file php_http_parser.c.

◆ TOKEN

#define TOKEN ( c)
Value:
tokens[(unsigned char)c]

Definition at line 241 of file php_http_parser.c.

◆ TRANSFER_ENCODING

#define TRANSFER_ENCODING   "transfer-encoding"

Definition at line 71 of file php_http_parser.c.

◆ UPGRADE

#define UPGRADE   "upgrade"

Definition at line 72 of file php_http_parser.c.

Enumeration Type Documentation

◆ flags

enum cdata flags = flags
Enumerator
F_CHUNKED 
F_CONNECTION_KEEP_ALIVE 
F_CONNECTION_CLOSE 
F_TRAILING 
F_UPGRADE 
F_SKIPBODY 

Definition at line 228 of file php_http_parser.c.

◆ header_states

Enumerator
h_general 
h_C 
h_CO 
h_CON 
h_matching_connection 
h_matching_proxy_connection 
h_matching_content_length 
h_matching_transfer_encoding 
h_matching_upgrade 
h_connection 
h_content_length 
h_transfer_encoding 
h_upgrade 
h_matching_transfer_encoding_chunked 
h_matching_connection_keep_alive 
h_matching_connection_close 
h_transfer_encoding_chunked 
h_connection_keep_alive 
h_connection_close 

Definition at line 201 of file php_http_parser.c.

Function Documentation

◆ php_http_method_str()

const char * php_http_method_str ( enum php_http_method m)

Definition at line 1545 of file php_http_parser.c.

◆ php_http_parser_execute()

size_t php_http_parser_execute ( php_http_parser * parser,
const php_http_parser_settings * settings,
const char * data,
size_t len )

Definition at line 256 of file php_http_parser.c.

◆ php_http_parser_init()

void php_http_parser_init ( php_http_parser * parser,
enum php_http_parser_type t )

Definition at line 1552 of file php_http_parser.c.

◆ php_http_should_keep_alive()

int php_http_should_keep_alive ( php_http_parser * parser)

Definition at line 1525 of file php_http_parser.c.