projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- fix HTTP_ETAG_CRC32
[m6w6/ext-http]
/
http_send_api.c
diff --git
a/http_send_api.c
b/http_send_api.c
index dc73233a7691599d0766d6a34815014838fb0e90..6fc9cc00916f3bfbc23ebf30b817bf1a780d0623 100644
(file)
--- a/
http_send_api.c
+++ b/
http_send_api.c
@@
-231,10
+231,7
@@
PHP_HTTP_API STATUS _http_send_etag_ex(const char *etag, size_t etag_len, char *
/* {{{ STATUS http_send_content_type(char *, size_t) */
PHP_HTTP_API STATUS _http_send_content_type(const char *content_type, size_t ct_len TSRMLS_DC)
{
/* {{{ STATUS http_send_content_type(char *, size_t) */
PHP_HTTP_API STATUS _http_send_content_type(const char *content_type, size_t ct_len TSRMLS_DC)
{
- if (!strchr(content_type, '/')) {
- http_error_ex(HE_WARNING, HTTP_E_INVALID_PARAM, "Content-Type '%s' doesn't seem to consist of a primary and a secondary part", content_type);
- return FAILURE;
- }
+ HTTP_CHECK_CONTENT_TYPE(content_type, return FAILURE);
/* remember for multiple ranges */
STR_FREE(HTTP_G(send).content_type);
/* remember for multiple ranges */
STR_FREE(HTTP_G(send).content_type);
@@
-355,10
+352,7
@@
PHP_HTTP_API STATUS _http_send_ex(const void *data_ptr, size_t data_size, http_s
}
/* stop on-the-fly etag generation */
}
/* stop on-the-fly etag generation */
- if (cache_etag = HTTP_G(etag).started) {
- /* interrupt ob_etaghandler */
- HTTP_G(etag).started = 0;
- }
+ cache_etag = http_interrupt_ob_etaghandler();
/* enable partial dl and resume */
http_send_header_string("Accept-Ranges: bytes");
/* enable partial dl and resume */
http_send_header_string("Accept-Ranges: bytes");
@@
-387,13
+381,11
@@
PHP_HTTP_API STATUS _http_send_ex(const void *data_ptr, size_t data_size, http_s
/* send 304 Not Modified if etag matches - DON'T return on ETag generation failure */
if (!no_cache && cache_etag) {
char *etag = NULL;
/* send 304 Not Modified if etag matches - DON'T return on ETag generation failure */
if (!no_cache && cache_etag) {
char *etag = NULL;
-
- if (!(etag = http_etag(data_ptr, data_size, data_mode))) {
- http_error(HE_NOTICE, HTTP_E_RUNTIME, "Failed to generate ETag for data source");
- } else {
+
+ if (etag = http_etag(data_ptr, data_size, data_mode)) {
char *sent_header = NULL;
char *sent_header = NULL;
- http_send_etag_ex(etag,
32
, &sent_header);
+ http_send_etag_ex(etag,
strlen(etag)
, &sent_header);
if (http_match_etag("HTTP_IF_NONE_MATCH", etag)) {
return http_exit_ex(304, sent_header, NULL, 0);
} else {
if (http_match_etag("HTTP_IF_NONE_MATCH", etag)) {
return http_exit_ex(304, sent_header, NULL, 0);
} else {