#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
-
#include "php.h"
+
#include "php_http.h"
#include "php_http_std_defs.h"
#include "php_http_api.h"
#include "phpstr/phpstr.h"
+ZEND_EXTERN_MODULE_GLOBALS(http);
+
#define http_message_headers_cb _http_message_headers_cb
static void _http_message_headers_cb(const char *http_line, HashTable **headers, void **message TSRMLS_DC)
{
}
}
-#define http_message_header(m, h) _http_message_header_ex((m), (h), sizeof(h))
-#define http_message_header_ex _http_message_header_ex
-static inline zval *_http_message_header_ex(http_message *msg, char *key_str, size_t key_len)
-{
- zval **header;
- if (SUCCESS == zend_hash_find(&msg->hdrs, key_str, key_len, (void **) &header)) {
- return *header;
- }
- return NULL;
-}
-
PHP_HTTP_API http_message *_http_message_init_ex(http_message *message, http_message_type type)
{
if (!message) {
zval *len;
char *tmp;
- spprintf(&tmp, 0, "%lu", decoded_len);
+ spprintf(&tmp, 0, "%lu", (ulong) decoded_len);
MAKE_STD_ZVAL(len);
ZVAL_STRING(len, tmp, 0);
} else
/* no headers that indicate content length */
- if (1) {
+ if (HTTP_MSG_TYPE(RESPONSE, msg)) {
phpstr_from_string_ex(PHPSTR(msg), body, message + message_length - body);
+ } else {
+ continue_at = body;
}
/* check for following messages */
if (!strcasecmp("HEAD", message->info.request.method)) {
rs = http_head(uri, Z_ARRVAL(options), NULL, NULL);
} else {
- http_error_ex(E_WARNING, HTTP_E_MSG,
+ http_error_ex(HE_WARNING, HTTP_E_REQUEST_METHOD,
"Cannot send HttpMessage. Request method %s not supported",
message->info.request.method);
}
efree(uri);
#else
- http_error(E_WARNING, HTTP_E_MSG, "HTTP requests not supported - ext/http was not linked against libcurl.");
+ http_error(HE_WARNING, HTTP_E_RUNTIME, "HTTP requests not supported - ext/http was not linked against libcurl.");
#endif
}
break;
case HTTP_MSG_NONE:
default:
- http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is neither of type HTTP_MSG_REQUEST nor HTTP_MSG_RESPONSE");
+ http_error(HE_WARNING, HTTP_E_MESSAGE_TYPE, "HttpMessage is neither of type HTTP_MSG_REQUEST nor HTTP_MSG_RESPONSE");
break;
}
* vim600: noet sw=4 ts=4 fdm=marker
* vim<600: noet sw=4 ts=4
*/
+