diff options
author | Anatol Belski <ab@php.net> | 2016-01-11 21:39:31 +0100 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2016-01-11 21:39:31 +0100 |
commit | ce568f98bf8dea3b6b4363cf871ac5e32e1bb6ba (patch) | |
tree | 45b6aa5294e4cadcbfaafff30c6fc38b13b99d43 | |
parent | 7954e5dc2ac227f3a584f93c2badcc5bc560bfdc (diff) | |
parent | f301a0b23c8f1170d0f635d6fea8f613a184a23f (diff) | |
download | php-git-ce568f98bf8dea3b6b4363cf871ac5e32e1bb6ba.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
Simplify code per Anatol.
Insert bug number.
Use strtoll() when apr_off_t is 64 bits.
-rw-r--r-- | sapi/apache2handler/sapi_apache2.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/sapi/apache2handler/sapi_apache2.c b/sapi/apache2handler/sapi_apache2.c index 289b59ae2f..4c69fa6b4d 100644 --- a/sapi/apache2handler/sapi_apache2.c +++ b/sapi/apache2handler/sapi_apache2.c @@ -123,15 +123,15 @@ php_apache_sapi_header_handler(sapi_header_struct *sapi_header, sapi_header_op_e } ctx->content_type = estrdup(val); } else if (!strcasecmp(sapi_header->header, "content-length")) { -#ifdef PHP_WIN32 -# ifdef APR_HAS_LARGE_FILES - ap_set_content_length(ctx->r, (apr_off_t) _strtoui64(val, (char **)NULL, 10)); -# else - ap_set_content_length(ctx->r, (apr_off_t) strtol(val, (char **)NULL, 10)); -# endif -#else - ap_set_content_length(ctx->r, (apr_off_t) strtol(val, (char **)NULL, 10)); -#endif + apr_off_t clen = 0; + + if (APR_SUCCESS != apr_strtoff(&clen, val, (char **) NULL, 10)) { + /* We'll fall back to strtol, since that's what we used to + * do anyway. */ + clen = (apr_off_t) strtol(val, (char **) NULL, 10); + } + + ap_set_content_length(ctx->r, clen); } else if (op == SAPI_HEADER_REPLACE) { apr_table_set(ctx->r->headers_out, sapi_header->header, val); } else { |