+PHP_RINIT_FUNCTION(http_request_method)
+{
+ HTTP_G->request.methods.custom.entries = ecalloc(1, sizeof(http_request_method_entry *));
+
+ if (HTTP_G->request.methods.custom.ini && *HTTP_G->request.methods.custom.ini) {
+ HashPosition pos;
+ HashTable methods;
+ zval **data;
+
+ zend_hash_init(&methods, 0, NULL, ZVAL_PTR_DTOR, 0);
+ http_parse_params(HTTP_G->request.methods.custom.ini, HTTP_PARAMS_DEFAULT, &methods);
+ FOREACH_HASH_VAL(pos, &methods, data) {
+ if (Z_TYPE_PP(data) == IS_STRING) {
+ http_request_method_register(Z_STRVAL_PP(data), Z_STRLEN_PP(data));
+ }
+ }
+ zend_hash_destroy(&methods);
+ }
+ return SUCCESS;
+}
+
+PHP_RSHUTDOWN_FUNCTION(http_request_method)
+{
+ int i;
+ http_request_method_entry **ptr = HTTP_G->request.methods.custom.entries;
+
+ for (i = 0; i < HTTP_G->request.methods.custom.count; ++i) {
+ if (ptr[i]) {
+ http_request_method_unregister(HTTP_CUSTOM_REQUEST_METHOD_START + i);
+ }
+ }
+ efree(HTTP_G->request.methods.custom.entries);
+
+ return SUCCESS;
+}
+/* }}} */
+