- more descriptive constant names
[m6w6/ext-http] / http_request_object.c
index 711872c..0a6c5d1 100644 (file)
@@ -296,45 +296,6 @@ static zend_object_handlers http_request_object_handlers;
 void _http_request_object_init(INIT_FUNC_ARGS)
 {
        HTTP_REGISTER_CLASS_EX(HttpRequest, http_request_object, NULL, 0);
-
-       /* HTTP/1.1 */
-       HTTP_LONG_CONSTANT("HTTP_GET", HTTP_GET);
-       HTTP_LONG_CONSTANT("HTTP_HEAD", HTTP_HEAD);
-       HTTP_LONG_CONSTANT("HTTP_POST", HTTP_POST);
-       HTTP_LONG_CONSTANT("HTTP_PUT", HTTP_PUT);
-       HTTP_LONG_CONSTANT("HTTP_DELETE", HTTP_DELETE);
-       HTTP_LONG_CONSTANT("HTTP_OPTIONS", HTTP_OPTIONS);
-       HTTP_LONG_CONSTANT("HTTP_TRACE", HTTP_TRACE);
-       HTTP_LONG_CONSTANT("HTTP_CONNECT", HTTP_CONNECT);
-       /* WebDAV - RFC 2518 */
-       HTTP_LONG_CONSTANT("HTTP_PROPFIND", HTTP_PROPFIND);
-       HTTP_LONG_CONSTANT("HTTP_PROPPATCH", HTTP_PROPPATCH);
-       HTTP_LONG_CONSTANT("HTTP_MKCOL", HTTP_MKCOL);
-       HTTP_LONG_CONSTANT("HTTP_COPY", HTTP_COPY);
-       HTTP_LONG_CONSTANT("HTTP_MOVE", HTTP_MOVE);
-       HTTP_LONG_CONSTANT("HTTP_LOCK", HTTP_LOCK);
-       HTTP_LONG_CONSTANT("HTTP_UNLOCK", HTTP_UNLOCK);
-       /* WebDAV Versioning - RFC 3253 */
-       HTTP_LONG_CONSTANT("HTTP_VERSION_CONTROL", HTTP_VERSION_CONTROL);
-       HTTP_LONG_CONSTANT("HTTP_REPORT", HTTP_REPORT);
-       HTTP_LONG_CONSTANT("HTTP_CHECKOUT", HTTP_CHECKOUT);
-       HTTP_LONG_CONSTANT("HTTP_CHECKIN", HTTP_CHECKIN);
-       HTTP_LONG_CONSTANT("HTTP_UNCHECKOUT", HTTP_UNCHECKOUT);
-       HTTP_LONG_CONSTANT("HTTP_MKWORKSPACE", HTTP_MKWORKSPACE);
-       HTTP_LONG_CONSTANT("HTTP_UPDATE", HTTP_UPDATE);
-       HTTP_LONG_CONSTANT("HTTP_LABEL", HTTP_LABEL);
-       HTTP_LONG_CONSTANT("HTTP_MERGE", HTTP_MERGE);
-       HTTP_LONG_CONSTANT("HTTP_BASELINE_CONTROL", HTTP_BASELINE_CONTROL);
-       HTTP_LONG_CONSTANT("HTTP_MKACTIVITY", HTTP_MKACTIVITY);
-       /* WebDAV Access Control - RFC 3744 */
-       HTTP_LONG_CONSTANT("HTTP_ACL", HTTP_ACL);
-
-
-#      if LIBCURL_VERSION_NUM >= 0x070a05
-       HTTP_LONG_CONSTANT("HTTP_AUTH_BASIC", CURLAUTH_BASIC);
-       HTTP_LONG_CONSTANT("HTTP_AUTH_DIGEST", CURLAUTH_DIGEST);
-       HTTP_LONG_CONSTANT("HTTP_AUTH_NTLM", CURLAUTH_NTLM);
-#      endif /* LIBCURL_VERSION_NUM */
 }
 
 zend_object_value _http_request_object_new(zend_class_entry *ce TSRMLS_DC)
@@ -382,6 +343,51 @@ static inline void _http_request_object_declare_default_properties(TSRMLS_D)
        DCL_PROP(PROTECTED, string, putFile, "");
 
        DCL_PROP(PUBLIC, bool, recordHistory, 1);
+
+       /*
+        * Request Method Constants
+        */
+       /* HTTP/1.1 */
+       DCL_CONST(long, "METH_GET", HTTP_GET);
+       DCL_CONST(long, "METH_HEAD", HTTP_HEAD);
+       DCL_CONST(long, "METH_POST", HTTP_POST);
+       DCL_CONST(long, "METH_PUT", HTTP_PUT);
+       DCL_CONST(long, "METH_DELETE", HTTP_DELETE);
+       DCL_CONST(long, "METH_OPTIONS", HTTP_OPTIONS);
+       DCL_CONST(long, "METH_TRACE", HTTP_TRACE);
+       DCL_CONST(long, "METH_CONNECT", HTTP_CONNECT);
+       /* WebDAV - RFC 2518 */
+       DCL_CONST(long, "METH_PROPFIND", HTTP_PROPFIND);
+       DCL_CONST(long, "METH_PROPPATCH", HTTP_PROPPATCH);
+       DCL_CONST(long, "METH_MKCOL", HTTP_MKCOL);
+       DCL_CONST(long, "METH_COPY", HTTP_COPY);
+       DCL_CONST(long, "METH_MOVE", HTTP_MOVE);
+       DCL_CONST(long, "METH_LOCK", HTTP_LOCK);
+       DCL_CONST(long, "METH_UNLOCK", HTTP_UNLOCK);
+       /* WebDAV Versioning - RFC 3253 */
+       DCL_CONST(long, "METH_VERSION_CONTROL", HTTP_VERSION_CONTROL);
+       DCL_CONST(long, "METH_REPORT", HTTP_REPORT);
+       DCL_CONST(long, "METH_CHECKOUT", HTTP_CHECKOUT);
+       DCL_CONST(long, "METH_CHECKIN", HTTP_CHECKIN);
+       DCL_CONST(long, "METH_UNCHECKOUT", HTTP_UNCHECKOUT);
+       DCL_CONST(long, "METH_MKWORKSPACE", HTTP_MKWORKSPACE);
+       DCL_CONST(long, "METH_UPDATE", HTTP_UPDATE);
+       DCL_CONST(long, "METH_LABEL", HTTP_LABEL);
+       DCL_CONST(long, "METH_MERGE", HTTP_MERGE);
+       DCL_CONST(long, "METH_BASELINE_CONTROL", HTTP_BASELINE_CONTROL);
+       DCL_CONST(long, "METH_MKACTIVITY", HTTP_MKACTIVITY);
+       /* WebDAV Access Control - RFC 3744 */
+       DCL_CONST(long, "METH_ACL", HTTP_ACL);
+
+       /*
+        * Auth Constants
+        */
+#      if LIBCURL_VERSION_NUM >= 0x070a05
+       DCL_CONST(long, "AUTH_BASIC", CURLAUTH_BASIC);
+       DCL_CONST(long, "AUTH_DIGEST", CURLAUTH_DIGEST);
+       DCL_CONST(long, "AUTH_NTLM", CURLAUTH_NTLM);
+       DCL_CONST(long, "AUTH_ANY", CURLAUTH_ANY);
+#      endif /* LIBCURL_VERSION_NUM */
 }
 
 void _http_request_object_free(zend_object *object TSRMLS_DC)