fielding 99/03/07 07:05:37
Modified: . STATUS htdocs/manual/misc API.html src ApacheCore.def CHANGES src/include ap_mmn.h http_request.h httpd.h src/main http_request.c src/support httpd.exp Log: Added ap_sub_req_method_uri() for doing a subrequest with a method other than GET, and const'd the definition of method in request_rec. Submitted by: Greg Stein <[EMAIL PROTECTED]> Reviewed by: Roy Fielding, Dean Gaudet, Doug MacEachern Revision Changes Path 1.637 +1 -5 apache-1.3/STATUS Index: STATUS =================================================================== RCS file: /home/cvs/apache-1.3/STATUS,v retrieving revision 1.636 retrieving revision 1.637 diff -u -r1.636 -r1.637 --- STATUS 1999/03/06 19:25:12 1.636 +++ STATUS 1999/03/07 15:05:29 1.637 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/03/06 19:25:12 $] + Last modified at [$Date: 1999/03/07 15:05:29 $] Release: @@ -136,10 +136,6 @@ * Ronald Tschalär's major update of mod_digest Message-ID: <[EMAIL PROTECTED]> Status: Big change -- needs review. - - * Greg Stein's ap_sub_req_method_uri() - Message-ID: <[EMAIL PROTECTED]> - Status: Doug +1, Lars +1 (concept) In progress: 1.18 +8 -6 apache-1.3/htdocs/manual/misc/API.html Index: API.html =================================================================== RCS file: /home/cvs/apache-1.3/htdocs/manual/misc/API.html,v retrieving revision 1.17 retrieving revision 1.18 diff -u -r1.17 -r1.18 --- API.html 1998/09/17 14:14:52 1.17 +++ API.html 1999/03/07 15:05:32 1.18 @@ -360,8 +360,9 @@ order to figure out what icon to use.<P> Such handlers can construct a <EM>sub-request</EM>, using the - functions <CODE>ap_sub_req_lookup_file</CODE> and - <CODE>ap_sub_req_lookup_uri</CODE>; this constructs a new + functions <CODE>ap_sub_req_lookup_file</CODE>, + <CODE>ap_sub_req_lookup_uri</CODE>, and + <CODE>ap_sub_req_method_uri</CODE>; these construct a new <CODE>request_rec</CODE> structure and processes it as you would expect, up to but not including the point of actually sending a response. (These functions skip over the access @@ -370,7 +371,7 @@ (Server-side includes work by building sub-requests and then actually invoking the response handler for them, via the - function <CODE>run_sub_request</CODE>). + function <CODE>ap_run_sub_req</CODE>). </UL> <H3><A NAME="req_return">Handling requests, declining, and returning error @@ -704,7 +705,8 @@ <LI>for the main request this is a subpool of connection->pool; for subrequests it is a subpool of the parent request's pool. </LI> - <LI>exists until the end of the request (<EM>i.e.</EM>, destroy_sub_req, or + <LI>exists until the end of the request (<EM>i.e.</EM>, + ap_destroy_sub_req, or in child_main after process_request has finished) </LI> <LI>note that r itself is allocated from r->pool; <EM>i.e.</EM>, @@ -818,7 +820,7 @@ One final note --- sub-requests have their own resource pools, which are sub-pools of the resource pool for the main request. The polite way to reclaim the resources associated with a sub request which you -have allocated (using the <CODE>ap_sub_req_lookup_...</CODE> functions) +have allocated (using the <CODE>ap_sub_req_...</CODE> functions) is <CODE>ap_destroy_sub_req</CODE>, which frees the resource pool. Before calling this function, be sure to copy anything that you care about which might be allocated in the sub-request's resource pool into @@ -830,7 +832,7 @@ request, and it will be freed anyway when the main request pool is cleared. It is only when you are allocating many, many sub-requests for a single main request that you should seriously consider the -<CODE>ap_destroy...</CODE> functions). +<CODE>ap_destroy_...</CODE> functions). <H2><A NAME="config">Configuration, commands and the like</A></H2> 1.13 +1 -0 apache-1.3/src/ApacheCore.def Index: ApacheCore.def =================================================================== RCS file: /home/cvs/apache-1.3/src/ApacheCore.def,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ApacheCore.def 1999/02/09 17:17:04 1.12 +++ ApacheCore.def 1999/03/07 15:05:33 1.13 @@ -343,4 +343,5 @@ ap_group_id @336 ap_standalone @337 ap_server_confname @338 + ap_sub_req_method_uri @339 1.1262 +4 -0 apache-1.3/src/CHANGES Index: CHANGES =================================================================== RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1261 retrieving revision 1.1262 diff -u -r1.1261 -r1.1262 --- CHANGES 1999/03/07 14:05:31 1.1261 +++ CHANGES 1999/03/07 15:05:33 1.1262 @@ -1,5 +1,9 @@ Changes with Apache 1.3.5 + *) Added ap_sub_req_method_uri() for doing a subrequest with a method + other than GET, and const'd the definition of method in request_rec. + [Greg Stein] + *) Use proper pid_t type for saving PIDs in alloc.c. [John Bley] *) Replaced use of WIN32 define with HAVE_DRIVE_LETTERS to indicate 1.29 +3 -1 apache-1.3/src/include/ap_mmn.h Index: ap_mmn.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/ap_mmn.h,v retrieving revision 1.28 retrieving revision 1.29 diff -u -r1.28 -r1.29 --- ap_mmn.h 1999/02/09 16:57:22 1.28 +++ ap_mmn.h 1999/03/07 15:05:35 1.29 @@ -209,6 +209,8 @@ * to use a stronger algorithm. * 19990108.4 - add ap_size_list_item(), ap_get_list_item(), and * ap_find_list_item() + * 19990108.5 - added ap_sub_req_method_uri() and added const to the + * definition of method in request_rec. */ #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ @@ -216,7 +218,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990108 #endif -#define MODULE_MAGIC_NUMBER_MINOR 4 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 5 /* 0...n */ #define MODULE_MAGIC_NUMBER MODULE_MAGIC_NUMBER_MAJOR /* backward compat */ /* Useful for testing for features. */ 1.27 +3 -0 apache-1.3/src/include/http_request.h Index: http_request.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/http_request.h,v retrieving revision 1.26 retrieving revision 1.27 diff -u -r1.26 -r1.27 --- http_request.h 1999/01/01 19:04:41 1.26 +++ http_request.h 1999/03/07 15:05:35 1.27 @@ -86,6 +86,9 @@ const request_rec *r); API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, const request_rec *r); +API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method, + const char *new_file, + const request_rec *r); API_EXPORT(int) ap_run_sub_req(request_rec *r); API_EXPORT(void) ap_destroy_sub_req(request_rec *r); 1.271 +1 -1 apache-1.3/src/include/httpd.h Index: httpd.h =================================================================== RCS file: /home/cvs/apache-1.3/src/include/httpd.h,v retrieving revision 1.270 retrieving revision 1.271 diff -u -r1.270 -r1.271 --- httpd.h 1999/02/22 17:13:02 1.270 +++ httpd.h 1999/03/07 15:05:35 1.271 @@ -668,7 +668,7 @@ * look, but don't touch. */ - char *method; /* GET, HEAD, POST, etc. */ + const char *method; /* GET, HEAD, POST, etc. */ int method_number; /* M_GET, M_POST, etc. */ /* 1.146 +13 -2 apache-1.3/src/main/http_request.c Index: http_request.c =================================================================== RCS file: /home/cvs/apache-1.3/src/main/http_request.c,v retrieving revision 1.145 retrieving revision 1.146 diff -u -r1.145 -r1.146 --- http_request.c 1999/03/07 13:13:52 1.145 +++ http_request.c 1999/03/07 15:05:36 1.146 @@ -718,8 +718,9 @@ return rr; } -API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file, - const request_rec *r) +API_EXPORT(request_rec *) ap_sub_req_method_uri(const char *method, + const char *new_file, + const request_rec *r) { request_rec *rnew; int res; @@ -736,6 +737,10 @@ ap_set_sub_req_protocol(rnew, r); + /* would be nicer to pass "method" to ap_set_sub_req_protocol */ + rnew->method = method; + rnew->method_number = ap_method_number_of(method); + if (new_file[0] == '/') ap_parse_uri(rnew, new_file); else { @@ -794,6 +799,12 @@ rnew->status = res; } return rnew; +} + +API_EXPORT(request_rec *) ap_sub_req_lookup_uri(const char *new_file, + const request_rec *r) +{ + return ap_sub_req_method_uri("GET", new_file, r); } API_EXPORT(request_rec *) ap_sub_req_lookup_file(const char *new_file, 1.17 +1 -0 apache-1.3/src/support/httpd.exp Index: httpd.exp =================================================================== RCS file: /home/cvs/apache-1.3/src/support/httpd.exp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- httpd.exp 1999/02/10 18:43:02 1.16 +++ httpd.exp 1999/03/07 15:05:37 1.17 @@ -326,6 +326,7 @@ ap_strcmp_match ap_sub_req_lookup_file ap_sub_req_lookup_uri +ap_sub_req_method_uri ap_suexec_enabled ap_sync_scoreboard_image ap_table_add