X-Git-Url: https://git.m6w6.name/?p=m6w6%2Fext-http;a=blobdiff_plain;f=php_http_api.h;h=25d305cf414ca23a3f3b3b619ad1ac261e8ed5c1;hp=8906e2cda71793ae61fc92852e73c4fa3f4d8c49;hb=52affd69e8de1f018146eef6fe5b60d2f1801294;hpb=f375fb41250882380286e13c3e5d23aa0765f529 diff --git a/php_http_api.h b/php_http_api.h index 8906e2c..25d305c 100644 --- a/php_http_api.h +++ b/php_http_api.h @@ -75,6 +75,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 /*