+/* {{{ */
+PHP_MINIT_FUNCTION(http_request_method)
+{
+ /* HTTP/1.1 */
+ HTTP_LONG_CONSTANT("HTTP_METH_GET", HTTP_GET);
+ HTTP_LONG_CONSTANT("HTTP_METH_HEAD", HTTP_HEAD);
+ HTTP_LONG_CONSTANT("HTTP_METH_POST", HTTP_POST);
+ HTTP_LONG_CONSTANT("HTTP_METH_PUT", HTTP_PUT);
+ HTTP_LONG_CONSTANT("HTTP_METH_DELETE", HTTP_DELETE);
+ HTTP_LONG_CONSTANT("HTTP_METH_OPTIONS", HTTP_OPTIONS);
+ HTTP_LONG_CONSTANT("HTTP_METH_TRACE", HTTP_TRACE);
+ HTTP_LONG_CONSTANT("HTTP_METH_CONNECT", HTTP_CONNECT);
+ /* WebDAV - RFC 2518 */
+ HTTP_LONG_CONSTANT("HTTP_METH_PROPFIND", HTTP_PROPFIND);
+ HTTP_LONG_CONSTANT("HTTP_METH_PROPPATCH", HTTP_PROPPATCH);
+ HTTP_LONG_CONSTANT("HTTP_METH_MKCOL", HTTP_MKCOL);
+ HTTP_LONG_CONSTANT("HTTP_METH_COPY", HTTP_COPY);
+ HTTP_LONG_CONSTANT("HTTP_METH_MOVE", HTTP_MOVE);
+ HTTP_LONG_CONSTANT("HTTP_METH_LOCK", HTTP_LOCK);
+ HTTP_LONG_CONSTANT("HTTP_METH_UNLOCK", HTTP_UNLOCK);
+ /* WebDAV Versioning - RFC 3253 */
+ HTTP_LONG_CONSTANT("HTTP_METH_VERSION_CONTROL", HTTP_VERSION_CONTROL);
+ HTTP_LONG_CONSTANT("HTTP_METH_REPORT", HTTP_REPORT);
+ HTTP_LONG_CONSTANT("HTTP_METH_CHECKOUT", HTTP_CHECKOUT);
+ HTTP_LONG_CONSTANT("HTTP_METH_CHECKIN", HTTP_CHECKIN);
+ HTTP_LONG_CONSTANT("HTTP_METH_UNCHECKOUT", HTTP_UNCHECKOUT);
+ HTTP_LONG_CONSTANT("HTTP_METH_MKWORKSPACE", HTTP_MKWORKSPACE);
+ HTTP_LONG_CONSTANT("HTTP_METH_UPDATE", HTTP_UPDATE);
+ HTTP_LONG_CONSTANT("HTTP_METH_LABEL", HTTP_LABEL);
+ HTTP_LONG_CONSTANT("HTTP_METH_MERGE", HTTP_MERGE);
+ HTTP_LONG_CONSTANT("HTTP_METH_BASELINE_CONTROL", HTTP_BASELINE_CONTROL);
+ HTTP_LONG_CONSTANT("HTTP_METH_MKACTIVITY", HTTP_MKACTIVITY);
+ /* WebDAV Access Control - RFC 3744 */
+ HTTP_LONG_CONSTANT("HTTP_METH_ACL", HTTP_ACL);
+
+ return SUCCESS;
+}
+
+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;
+}
+/* }}} */
+