- if (by_name) {
- for (i = HTTP_MIN_REQUEST_METHOD; i < HTTP_MAX_REQUEST_METHOD; ++i) {
- if (!strcasecmp(name, http_request_methods[i])) {
- return i;
- }
- }
- for (i = 0; i < HTTP_G->request.methods.custom.count; ++i) {
- if (ptr[i] && !strcasecmp(name, ptr[i]->name)) {
- return HTTP_CUSTOM_REQUEST_METHOD_START + i;
+ zend_hash_init(&HTTP_G->request.methods.registered, 0, NULL, free_method, 0);
+#define HTTP_METH_REG(m) \
+ { \
+ char *_m=estrdup(m); \
+ zend_hash_next_index_insert(&HTTP_G->request.methods.registered, (void *) &_m, sizeof(char *), NULL); \
+ }
+ HTTP_METH_REG("UNKNOWN");
+ /* HTTP/1.1 */
+ HTTP_METH_REG("GET");
+ HTTP_METH_REG("HEAD");
+ HTTP_METH_REG("POST");
+ HTTP_METH_REG("PUT");
+ HTTP_METH_REG("DELETE");
+ HTTP_METH_REG("OPTIONS");
+ HTTP_METH_REG("TRACE");
+ HTTP_METH_REG("CONNECT");
+ /* WebDAV - RFC 2518 */
+ HTTP_METH_REG("PROPFIND");
+ HTTP_METH_REG("PROPPATCH");
+ HTTP_METH_REG("MKCOL");
+ HTTP_METH_REG("COPY");
+ HTTP_METH_REG("MOVE");
+ HTTP_METH_REG("LOCK");
+ HTTP_METH_REG("UNLOCK");
+ /* WebDAV Versioning - RFC 3253 */
+ HTTP_METH_REG("VERSION-CONTROL");
+ HTTP_METH_REG("REPORT");
+ HTTP_METH_REG("CHECKOUT");
+ HTTP_METH_REG("CHECKIN");
+ HTTP_METH_REG("UNCHECKOUT");
+ HTTP_METH_REG("MKWORKSPACE");
+ HTTP_METH_REG("UPDATE");
+ HTTP_METH_REG("LABEL");
+ HTTP_METH_REG("MERGE");
+ HTTP_METH_REG("BASELINE-CONTROL");
+ HTTP_METH_REG("MKACTIVITY");
+ /* WebDAV Access Control - RFC 3744 */
+ HTTP_METH_REG("ACL");
+
+ zend_hash_init(&ht, 0, NULL, ZVAL_PTR_DTOR, 0);
+ if (*HTTP_G->request.methods.custom && SUCCESS == http_parse_params(HTTP_G->request.methods.custom, HTTP_PARAMS_DEFAULT, &ht)) {
+ HashPosition pos;
+ zval **val;
+
+ FOREACH_HASH_VAL(pos, &ht, val) {
+ if (Z_TYPE_PP(val) == IS_STRING) {
+ http_request_method_register(Z_STRVAL_PP(val), Z_STRLEN_PP(val));