You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mod_python-commits@quetz.apache.org by gr...@apache.org on 2006/03/05 02:29:06 UTC

svn commit: r383266 - in /httpd/mod_python/trunk: Doc/appendixc.tex Doc/modpython4.tex src/requestobject.c

Author: grahamd
Date: Sat Mar  4 17:29:05 2006
New Revision: 383266

URL: http://svn.apache.org/viewcvs?rev=383266&view=rev
Log:
Make req.proxyreq and req.uri modifiable so that it is possible to trigger
proxy redirects for a request. (MODPYTHON-141)

Modified:
    httpd/mod_python/trunk/Doc/appendixc.tex
    httpd/mod_python/trunk/Doc/modpython4.tex
    httpd/mod_python/trunk/src/requestobject.c

Modified: httpd/mod_python/trunk/Doc/appendixc.tex
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/appendixc.tex?rev=383266&r1=383265&r2=383266&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/appendixc.tex (original)
+++ httpd/mod_python/trunk/Doc/appendixc.tex Sat Mar  4 17:29:05 2006
@@ -50,6 +50,11 @@
       The \code{req.handler} attribute is now writable. This allows a handler
       executing in a phase prior to the response phase to specify which
       Apache module will be responsible for generating the content.
+    \item
+      (\citetitle[http://issues.apache.org/jira/browse/MODPYTHON-141]{MODPYTHON-141})
+      The \code{req.proxyreq} and \code{req.uri} attributes are now writable.
+      This allows a handler to setup these values and trigger proxying of the
+      current request to a remote server.
   \end{itemize}
 
   Bug Fixes

Modified: httpd/mod_python/trunk/Doc/modpython4.tex
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/Doc/modpython4.tex?rev=383266&r1=383265&r2=383266&view=diff
==============================================================================
--- httpd/mod_python/trunk/Doc/modpython4.tex (original)
+++ httpd/mod_python/trunk/Doc/modpython4.tex Sat Mar  4 17:29:05 2006
@@ -981,7 +981,6 @@
 
 \begin{memberdesc}[request]{proxyreq}
   A proxy request: one of \constant{apache.PROXYREQ_*} values.
-  \emph{(Read-Only})
 \end{memberdesc}
 
 \begin{memberdesc}[request]{header_only}
@@ -1216,7 +1215,6 @@
 
 \begin{memberdesc}[request]{uri}
   The path portion of the URI.
-  \emph{(Read-Only})
 \end{memberdesc}
 
 \begin{memberdesc}[request]{filename}

Modified: httpd/mod_python/trunk/src/requestobject.c
URL: http://svn.apache.org/viewcvs/httpd/mod_python/trunk/src/requestobject.c?rev=383266&r1=383265&r2=383266&view=diff
==============================================================================
--- httpd/mod_python/trunk/src/requestobject.c (original)
+++ httpd/mod_python/trunk/src/requestobject.c Sat Mar  4 17:29:05 2006
@@ -1515,6 +1515,15 @@
             apr_pstrdup(self->request_rec->pool, PyString_AsString(val));
         return 0;
     }
+    else if (strcmp(name, "uri") == 0) {
+        if (! PyString_Check(val)) {
+            PyErr_SetString(PyExc_TypeError, "uri must be a string");
+            return -1;
+        }
+        self->request_rec->uri = 
+            apr_pstrdup(self->request_rec->pool, PyString_AsString(val));
+        return 0;
+    }
     
     return PyMember_SetOne((char*)self->request_rec, 
                            find_memberdef(request_rec_mbrs, (char*)name),
@@ -1675,7 +1684,7 @@
     {"main",       (getter)getmakeobj, NULL, "If subrequest, pointer to the main request", "main"},
     {"the_request", (getter)getreq_recmbr, NULL, "First line of request", "the_request"},
     {"assbackwards", (getter)getreq_recmbr, (setter)setreq_recmbr, "HTTP/0.9 \"simple\" request", "assbackwards"},
-    {"proxyreq",     (getter)getreq_recmbr, NULL, "A proxy request: one of apache.PROXYREQ_* values", "proxyreq"},
+    {"proxyreq",     (getter)getreq_recmbr, (setter)setreq_recmbr, "A proxy request: one of apache.PROXYREQ_* values", "proxyreq"},
     {"header_only",  (getter)getreq_recmbr, NULL, "HEAD request, as oppsed to GET", "header_only"},
     {"protocol",     (getter)getreq_recmbr, NULL, "Protocol as given to us, or HTTP/0.9", "protocol"},
     {"proto_num",    (getter)getreq_recmbr, NULL, "Protocol version. 1.1 = 1001", "proto_num"},
@@ -1709,7 +1718,7 @@
     {"no_cache",      (getter)getreq_recmbr, NULL, "This response in non-cacheable", "no_cache"},
     {"no_local_copy", (getter)getreq_recmbr, NULL, "There is no local copy of the response", "no_local_copy"},
     {"unparsed_uri",  (getter)getreq_recmbr, NULL, "The URI without any parsing performed", "unparsed_uri"},
-    {"uri",           (getter)getreq_recmbr, NULL, "The path portion of URI", "uri"},
+    {"uri",           (getter)getreq_recmbr, (setter)setreq_recmbr, "The path portion of URI", "uri"},
     {"filename",      (getter)getreq_recmbr, (setter)setreq_recmbr, "The file name on disk that this request corresponds to", "filename"},
     {"canonical_filename", (getter)getreq_recmbr, NULL, "The true filename (req.filename is canonicalized if they dont match)", "canonical_filename"},
     {"path_info",     (getter)getreq_recmbr, (setter)setreq_recmbr, "Path_info, if any", "path_info"},