+PHP_METHOD(HttpMessage, setRequestMethod)
+{
+ char *method;
+ int method_len;
+ getObject(http_message_object, obj);
+
+ if (!HTTP_MSG_TYPE(REQUEST, obj->message)) {
+ http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is not of type HTTP_MSG_REQUEST");
+ RETURN_FALSE;
+ }
+
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &method, &method_len)) {
+ RETURN_FALSE;
+ }
+ if (method_len < 1) {
+ http_error(E_WARNING, HTTP_E_PARAM, "Cannot set HttpMessage::requestMethod to an empty string");
+ RETURN_FALSE;
+ }
+ if (SUCCESS != http_check_method(method)) {
+ http_error_ex(E_WARNING, HTTP_E_PARAM, "Unkown request method: %s", method);
+ RETURN_FALSE;
+ }
+
+ STR_SET(obj->message->info.request.method, estrndup(method, method_len));
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto string HttpMessage::getRequestUri()
+ *
+ * Get the Request URI of the Message.
+ */
+PHP_METHOD(HttpMessage, getRequestUri)
+{
+ NO_ARGS;
+
+ IF_RETVAL_USED {
+ zval *uri;
+ getObject(http_message_object, obj);
+
+ if (!HTTP_MSG_TYPE(REQUEST, obj->message)) {
+ http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is not of type HTTP_MSG_REQUEST");
+ RETURN_NULL();
+ }
+
+ RETURN_STRING(obj->message->info.request.URI, 1);
+ }
+}
+/* }}} */
+
+/* {{{ proto bool HttpMessage::setRequestUri(string URI)
+ *
+ * Set the Request URI of the HTTP Message.
+ * Returns false if the Message is not of type HTTP_MSG_REQUEST,
+ * or if paramtere URI was empty.
+ */
+PHP_METHOD(HttpMessage, setRequestUri)
+{
+ char *URI;
+ int URIlen;
+ getObject(http_message_object, obj);
+
+ if (!HTTP_MSG_TYPE(REQUEST, obj->message)) {
+ http_error(E_WARNING, HTTP_E_MSG, "HttpMessage is not of type HTTP_MSG_REQUEST");
+ RETURN_FALSE;
+ }
+ if (SUCCESS != zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &URI, &URIlen)) {
+ RETURN_FALSE;
+ }
+ if (URIlen < 1) {
+ http_error(E_WARNING, HTTP_E_PARAM, "Cannot set HttpMessage::requestUri to an empty string");
+ RETURN_FALSE;
+ }
+
+ STR_SET(obj->message->info.request.URI, estrndup(URI, URIlen));
+ RETURN_TRUE;
+}
+/* }}} */
+
+/* {{{ proto string HttpMessage::getHttpVersion()
+ *
+ * Get the HTTP Protocol Version of the Message.
+ */
+PHP_METHOD(HttpMessage, getHttpVersion)