2 +--------------------------------------------------------------------+
4 +--------------------------------------------------------------------+
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the conditions mentioned |
7 | in the accompanying LICENSE file are met. |
8 +--------------------------------------------------------------------+
9 | Copyright (c) 2004-2007, Michael Wallner <mike@php.net> |
10 +--------------------------------------------------------------------+
15 #ifndef PHP_HTTP_INFO_API_H
16 #define PHP_HTTP_INFO_API_H
18 #define IS_HTTP_REQUEST 1
19 #define IS_HTTP_RESPONSE 2
21 #define HTTP_INFO(ptr) (ptr)->http.info
23 #define HTTP_INFO_REQUEST_FMT_ARGS(_http_ptr, _EOL) "%s %s HTTP/%1.1f" _EOL, \
24 (_http_ptr)->info.request.method?(_http_ptr)->info.request.method:"UNKNOWN", \
25 (_http_ptr)->info.request.url?(_http_ptr)->info.request.url:"/", \
26 (_http_ptr)->version>0.0?(_http_ptr)->version:1.1
28 #define HTTP_INFO_RESPONSE_FMT_ARGS(_http_ptr, _EOL) "HTTP/%1.1f %d%s%s" _EOL, \
29 (_http_ptr)->version>0.0?(_http_ptr)->version:1.1, \
30 (_http_ptr)->info.response.code?(_http_ptr)->info.response.code:200, \
31 (_http_ptr)->info.response.status&&*(_http_ptr)->info.response.status ? " ":"", \
32 STR_PTR((_http_ptr)->info.response.status)
34 typedef struct _http_request_info_t
{
39 typedef struct _http_response_info_t
{
44 typedef union _http_info_union_t
{
45 http_request_info request
;
46 http_response_info response
;
54 typedef struct _http_info_t
{
55 struct http_info http
;
59 typedef void (*http_info_callback
)(void **callback_data
, HashTable
**headers
, http_info
*info TSRMLS_DC
);
61 #define http_info_default_callback _http_info_default_callback
62 PHP_HTTP_API
void _http_info_default_callback(void **nothing
, HashTable
**headers
, http_info
*info TSRMLS_DC
);
63 #define http_info_dtor _http_info_dtor
64 PHP_HTTP_API
void _http_info_dtor(http_info
*info
);
65 #define http_info_parse(p, i) _http_info_parse_ex((p), (i), 1 TSRMLS_CC)
66 #define http_info_parse_ex(p, i, s) _http_info_parse_ex((p), (i), (s) TSRMLS_CC)
67 PHP_HTTP_API STATUS
_http_info_parse_ex(const char *pre_header
, http_info
*info
, zend_bool silent TSRMLS_DC
);
76 * vim600: noet sw=4 ts=4 fdm=marker
77 * vim<600: noet sw=4 ts=4