X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=http_message_api.c;h=1cf8661546574505b5d3d1dd255713c585c2b058;hb=73ca84f4751d2197ee39b92c3b924b8e64b0ff0d;hp=a0f5e59ada74c8a79fa40d0ef693dd0b2eb7b117;hpb=bb6571e22d14c87114eb729145be2e7b87ebea42;p=m6w6%2Fext-http diff --git a/http_message_api.c b/http_message_api.c index a0f5e59..1cf8661 100644 --- a/http_message_api.c +++ b/http_message_api.c @@ -18,8 +18,8 @@ #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" @@ -412,6 +412,21 @@ PHP_HTTP_API STATUS _http_message_send(http_message *message TSRMLS_DC) return rs; } +PHP_HTTP_API http_message *_http_message_dup(http_message *msg TSRMLS_DC) +{ + /* + * TODO: unroll + */ + http_message *new; + char *serialized_data; + size_t serialized_length; + + http_message_serialize(msg, &serialized_data, &serialized_length); + new = http_message_parse(serialized_data, serialized_length); + efree(serialized_data); + return new; +} + PHP_HTTP_API void _http_message_dtor(http_message *message) { if (message) {