projects
/
m6w6
/
ext-http
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
- add note about FastCGI buffering/flush issue (throttling)
[m6w6/ext-http]
/
http_response_object.c
diff --git
a/http_response_object.c
b/http_response_object.c
index ba1ae4073ef9991f805aacd681735f8d12fadbbc..37c45f8c65d1a379abc16d374f30fd435b313407 100644
(file)
--- a/
http_response_object.c
+++ b/
http_response_object.c
@@
-41,6
+41,9
@@
#ifdef HTTP_HAVE_MHASH
# include <mhash.h>
#endif
#ifdef HTTP_HAVE_MHASH
# include <mhash.h>
#endif
+#ifdef HTTP_HAVE_MAGIC
+# include <magic.h>
+#endif
ZEND_EXTERN_MODULE_GLOBALS(http);
ZEND_EXTERN_MODULE_GLOBALS(http);
@@
-238,14
+241,20
@@
static inline void _http_response_object_declare_default_properties(TSRMLS_D)
DCL_STATIC_PROP(PROTECTED, double, throttleDelay, 0.0);
#ifndef WONKY
DCL_STATIC_PROP(PROTECTED, double, throttleDelay, 0.0);
#ifndef WONKY
+ DCL_CONST(long, "REDIRECT", HTTP_REDIRECT);
+ DCL_CONST(long, "REDIRECT_PERM", HTTP_REDIRECT_PERM);
+ DCL_CONST(long, "REDIRECT_POST", HTTP_REDIRECT_POST);
+ DCL_CONST(long, "REDIRECT_TEMP", HTTP_REDIRECT_TEMP);
+
DCL_CONST(long, "ETAG_MD5", HTTP_ETAG_MD5);
DCL_CONST(long, "ETAG_SHA1", HTTP_ETAG_SHA1);
DCL_CONST(long, "ETAG_MD5", HTTP_ETAG_MD5);
DCL_CONST(long, "ETAG_SHA1", HTTP_ETAG_SHA1);
+ DCL_CONST(long, "ETAG_CRC32", HTTP_ETAG_CRC32);
# ifdef HTTP_HAVE_MHASH
{
int l, i, c = mhash_count();
# ifdef HTTP_HAVE_MHASH
{
int l, i, c = mhash_count();
- for (i = 0; i < c; ++i) {
+ for (i = 0; i <
=
c; ++i) {
char const_name[256] = {0};
const char *hash_name = mhash_get_hash_name_static(i);
char const_name[256] = {0};
const char *hash_name = mhash_get_hash_name_static(i);
@@
-499,7
+508,7
@@
PHP_METHOD(HttpResponse, getContentType)
}
/* }}} */
}
/* }}} */
-/* {{{ proto static string HttpResponse::guessContentType(string magic_file[, long magic_mode])
+/* {{{ proto static string HttpResponse::guessContentType(string magic_file[, long magic_mode
= MAGIC_MIME
])
*
* Attempts to guess the content type of supplied payload through libmagic.
*/
*
* Attempts to guess the content type of supplied payload through libmagic.
*/
@@
-511,6
+520,9
@@
PHP_METHOD(HttpResponse, guessContentType)
RETVAL_NULL();
RETVAL_NULL();
+#ifdef HTTP_HAVE_MAGIC
+ magic_mode = MAGIC_MIME;
+
SET_EH_THROW_HTTP();
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &magic_file, &magic_file_len, &magic_mode)) {
switch (Z_LVAL_P(GET_STATIC_PROP(mode))) {
SET_EH_THROW_HTTP();
if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|l", &magic_file, &magic_file_len, &magic_mode)) {
switch (Z_LVAL_P(GET_STATIC_PROP(mode))) {
@@
-541,6
+553,9
@@
PHP_METHOD(HttpResponse, guessContentType)
}
}
SET_EH_NORMAL();
}
}
SET_EH_NORMAL();
+#else
+ http_error(HE_THROW, HTTP_E_RUNTIME, "Cannot guess Content-Type; libmagic not available");
+#endif
}
/* }}} */
}
/* }}} */