From: Brian Havard Date: Sun, 31 Oct 1999 09:26:03 +0000 (+0000) Subject: Eliminate use of FILE * & ap_get_os_file() in mod_asis by APRizing X-Git-Tag: 1.3.10~205 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d25def53631f8e058306a6f37ffd74573f28b38f;p=thirdparty%2Fapache%2Fhttpd.git Eliminate use of FILE * & ap_get_os_file() in mod_asis by APRizing ap_scan_script_header_err(). git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84078 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/util_script.h b/include/util_script.h index 6ef075aa9e9..36c1067b052 100644 --- a/include/util_script.h +++ b/include/util_script.h @@ -74,7 +74,7 @@ API_EXPORT(char **) ap_create_environment(ap_context_t *p, ap_table_t *t); API_EXPORT(int) ap_find_path_info(const char *uri, const char *path_info); API_EXPORT(void) ap_add_cgi_vars(request_rec *r); API_EXPORT(void) ap_add_common_vars(request_rec *r); -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, char *buffer); +API_EXPORT(int) ap_scan_script_header_err(request_rec *r, ap_file_t *f, char *buffer); API_EXPORT(int) ap_scan_script_header_err_buff(request_rec *r, BUFF *f, char *buffer); API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, diff --git a/modules/generators/mod_asis.c b/modules/generators/mod_asis.c index 8357f486987..c7ea640f5a7 100644 --- a/modules/generators/mod_asis.c +++ b/modules/generators/mod_asis.c @@ -68,8 +68,6 @@ static int asis_handler(request_rec *r) ap_file_t *f; ap_status_t status; const char *location; - FILE *thefile; /* XXX leave these alone until we convert */ - int thefd; /* everything to use apr_file_t's. */ r->allowed |= (1 << M_GET); if (r->method_number != M_GET) @@ -87,10 +85,7 @@ static int asis_handler(request_rec *r) return FORBIDDEN; } - ap_get_os_file(&thefd, f); - thefile = fdopen(thefd, "r"); - - ap_scan_script_header_err(r, thefile, NULL); + ap_scan_script_header_err(r, f, NULL); location = ap_table_get(r->headers_out, "Location"); if (location && location[0] == '/' && @@ -113,8 +108,6 @@ static int asis_handler(request_rec *r) ap_send_http_header(r); if (!r->header_only) { - ap_off_t zero = 0; - ap_seek(f, APR_CUR, &zero); ap_send_fd(f, r); } diff --git a/server/util_script.c b/server/util_script.c index 187d9015e70..7f1f4d57cae 100644 --- a/server/util_script.c +++ b/server/util_script.c @@ -605,10 +605,10 @@ API_EXPORT(int) ap_scan_script_header_err_core(request_rec *r, char *buffer, static int getsfunc_FILE(char *buf, int len, void *f) { - return fgets(buf, len, (FILE *) f) != NULL; + return ap_fgets(buf, len, (ap_file_t *) f) == APR_SUCCESS; } -API_EXPORT(int) ap_scan_script_header_err(request_rec *r, FILE *f, +API_EXPORT(int) ap_scan_script_header_err(request_rec *r, ap_file_t *f, char *buffer) { return ap_scan_script_header_err_core(r, buffer, getsfunc_FILE, f);