| 130 | } |
| 131 | |
| 132 | static int |
| 133 | dialup_handler(request_rec *r) |
| 134 | { |
| 135 | int status; |
| 136 | apr_status_t rv; |
| 137 | dialup_dcfg_t *dcfg; |
| 138 | core_dir_config *ccfg; |
| 139 | apr_file_t *fd; |
| 140 | dialup_baton_t *db; |
| 141 | apr_bucket *e; |
| 142 | |
| 143 | |
| 144 | /* See core.c, default handler for all of the cases we just decline. */ |
| 145 | if (r->method_number != M_GET || |
| 146 | r->finfo.filetype == APR_NOFILE || |
| 147 | r->finfo.filetype == APR_DIR) { |
| 148 | return DECLINED; |
| 149 | } |
| 150 | |
| 151 | dcfg = ap_get_module_config(r->per_dir_config, |
| 152 | &dialup_module); |
| 153 | |
| 154 | if (dcfg->bytes_per_second == 0) { |
| 155 | return DECLINED; |
| 156 | } |
| 157 | |
| 158 | ccfg = ap_get_core_module_config(r->per_dir_config); |
| 159 | |
| 160 | |
| 161 | rv = apr_file_open(&fd, r->filename, APR_READ | APR_BINARY |
| 162 | #if APR_HAS_SENDFILE |
| 163 | | AP_SENDFILE_ENABLED(ccfg->enable_sendfile) |
| 164 | #endif |
| 165 | , 0, r->pool); |
| 166 | |
| 167 | if (rv) { |
| 168 | return DECLINED; |
| 169 | } |
| 170 | |
| 171 | /* copied from default handler: */ |
| 172 | ap_update_mtime(r, r->finfo.mtime); |
| 173 | ap_set_last_modified(r); |
| 174 | ap_set_etag_fd(r, fd); |
| 175 | ap_set_accept_ranges(r); |
| 176 | ap_set_content_length(r, r->finfo.size); |
| 177 | |
| 178 | status = ap_meets_conditions(r); |
| 179 | if (status != OK) { |
| 180 | ap_log_rerror(APLOG_MARK, APLOG_ERR, 0, r, APLOGNO(01869) |
| 181 | "dialup: declined, meets conditions, good luck core handler"); |
| 182 | return DECLINED; |
| 183 | } |
| 184 | |
| 185 | db = apr_palloc(r->pool, sizeof(dialup_baton_t)); |
| 186 | |
| 187 | db->bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); |
| 188 | db->tmpbb = apr_brigade_create(r->pool, r->connection->bucket_alloc); |
| 189 |
nothing calls this directly
no test coverage detected