X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=666c33bd36bbba6a140ebee6fda07f72ed1d1759;hp=8906e2cda71793ae61fc92852e73c4fa3f4d8c49;hb=b3f63f934af3f17acb719130471ca6caca59e858;hpb=0d925a2820b9d75b8e32c451fd400863e51e22fe diff --git a/php_http_api.h b/php_http_api.h index 8906e2c..666c33b 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -35,6 +35,9 @@ extern STATUS _http_parse_key_list(const char *list, HashTable *items, char sepa #define http_error_ex _http_error_ex extern void _http_error_ex(long type, long code, const char *format, ...) PHP_ATTRIBUTE_FORMAT(printf, 3, 4); +#define http_log(f, i, m) _http_log_ex((f), (i), (m) TSRMLS_CC) +extern void http_log_ex(char *file, const char *ident, const char *message TSRMLS_DC); + #define http_exit(s, h) http_exit_ex((s), (h), NULL, 1) #define http_exit_ex(s, h, b, e) _http_exit_ex((s), (h), (b), (e) TSRMLS_CC) extern STATUS _http_exit_ex(int status, char *header, char *body, zend_bool send_header TSRMLS_DC); @@ -75,6 +78,17 @@ static inline const char *_http_locate_body(const char *message) } } +#define http_locate_eol _http_locate_eol +static inline const char *_http_locate_eol(const char *line, size_t *eol_len) +{ + const char *eol = strpbrk(line, "\r\n"); + + if (eol_len) { + *eol_len = eol ? ((eol[0] == '\r' && eol[1] == '\n') ? 2 : 1) : 0; + } + return eol; +} + #endif /*