| 1 |
#cxx . . $ `<file>/mod_upload_progress.c`/include <stdint.h> |
| 2 |
#include <ctype.h> |
| 3 |
#include <ap_config.h> |
| 4 |
#include <http_core.h> |
| 5 |
#include <http_log.h> |
| 6 |
#include <http_protocol.h> |
| 7 |
#include <http_request.h> |
| 8 |
#include <apr_version.h> |
| 9 |
#include <apr_pools.h> |
| 10 |
#include <apr_strings.h> |
| 11 |
#include "unixd.h" |
| 12 |
|
| 13 |
#if APR_HAS_SHARED_MEMORYcxx . . $ `<external>/18006479708876329136/apr.h:294:9`! |
| 14 |
#include "apr_rmm.h" |
| 15 |
#include "apr_shm.h" |
| 16 |
#else |
| 17 |
#error "APR_HAS_SHARED_MEMORY required for upload_progress module" |
| 18 |
#endif |
| 19 |
|
| 20 |
#if APR_HAVE_UNISTD_Hcxx . . $ `<external>/18006479708876329136/apr.h:114:9`! |
| 21 |
#include <unistd.h> |
| 22 |
#endif |
| 23 |
|
| 24 |
#include "ap_backports.h"cxx . . $ `<file>/ap_backports.h`/ |
| 25 |
|
| 26 |
#ifndef PROGRESS_ID |
| 27 |
# define PROGRESS_IDcxx . . $ `mod_upload_progress.c:27:11`! "X-Progress-ID" |
| 28 |
#endif |
| 29 |
#ifndef JSON_CB_PARAM |
| 30 |
# define JSON_CB_PARAMcxx . . $ `mod_upload_progress.c:30:11`! "callback" |
| 31 |
#endif |
| 32 |
#ifndef CACHE_FILENAME |
| 33 |
# define CACHE_FILENAMEcxx . . $ `mod_upload_progress.c:33:11`! "/tmp/upload_progress_cache" |
| 34 |
#endif |
| 35 |
#ifndef PROGRESS_EXPIRES |
| 36 |
/* shared memory entries not updated in PROGRESS_EXPIRES seconds |
| 37 |
will be reused when needed */ |
| 38 |
# define PROGRESS_EXPIREScxx . . $ `mod_upload_progress.c:38:11`! 60 |
| 39 |
#endif |
| 40 |
#ifndef UP_DEBUG |
| 41 |
# define UP_DEBUGcxx . . $ `mod_upload_progress.c:41:11`! 0 |
| 42 |
#endif |
| 43 |
|
| 44 |
#ifndef ARG_ALLOWED_PROGRESSID |
| 45 |
# define ARG_ALLOWED_PROGRESSIDcxx . . $ `mod_upload_progress.c:45:11`! "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_:./!{}" |
| 46 |
#endif |
| 47 |
#ifndef ARG_ALLOWED_JSONPCALLBACK |
| 48 |
# define ARG_ALLOWED_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:48:11`! "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._$" |
| 49 |
#endif |
| 50 |
#ifndef ARG_MINLEN_PROGRESSID |
| 51 |
# define ARG_MINLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:51:11`! 8 |
| 52 |
#endif |
| 53 |
#ifndef ARG_MAXLEN_PROGRESSID |
| 54 |
# define ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`! 128 |
| 55 |
#endif |
| 56 |
#define UP_STRINGIFYcxx . . $ `mod_upload_progress.c:56:9`!(arg) #arg |
| 57 |
#define UP_TOSTRINGcxx . . $ `mod_upload_progress.c:57:9`!(arg) UP_STRINGIFYcxx . . $ `mod_upload_progress.c:56:9`!(arg) |
| 58 |
#define UP_ID_FMTcxx . . $ `mod_upload_progress.c:58:9`! "." UP_TOSTRINGcxx . . $ `mod_upload_progress.c:57:9`!(ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!) "s" |
| 59 |
#ifndef ARG_MINLEN_JSONPCALLBACK |
| 60 |
# define ARG_MINLEN_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:60:11`! 1 |
| 61 |
#endif |
| 62 |
#ifndef ARG_MAXLEN_JSONPCALLBACK |
| 63 |
/* This limit is set by most JS implementations on identifier length */ |
| 64 |
# define ARG_MAXLEN_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:64:11`! 64 |
| 65 |
#endif |
| 66 |
|
| •67 |
#ifdef APLOG_USE_MODULEcxx . . $ `<external>/11954595451903284094/http_config.h:453:9`! |
| 68 |
APLOG_USE_MODULEcxx . . $ `<external>/11954595451903284094/http_config.h:453:9`!(upload_progress); |
| 69 |
#endif |
| 70 |
|
| 71 |
#if UP_DEBUGcxx . . $ `mod_upload_progress.c:41:11`! > 0 |
| •72 |
# if !defined(APLOG_USE_MODULE) && UP_DEBUG > 1 |
| 73 |
# define up_log(m,s,err,srv,fmtstr,...) ap_log_error( m, s, err, srv, "pid:%" APR_PID_T_FMT " " fmtstr, getpid(), ##__VA_ARGS__ ) |
| 74 |
# else |
| 75 |
# define up_log(...) ap_log_error( __VA_ARGS__ ) |
| 76 |
# endif |
| 77 |
#else |
| 78 |
# define up_logcxx . . $ `mod_upload_progress.c:78:11`!(...) |
| 79 |
#endif |
| 80 |
|
| 81 |
#define CACHE_LOCKcxx . . $ `mod_upload_progress.c:81:9`!() do { \ |
| 82 |
if (config->cache_lock) { \ |
| 83 |
char errbuf[200]; \ |
| 84 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "CACHE_LOCK()"); \ |
| 85 |
apr_status_t status = apr_global_mutex_lock(config->cache_lock); \ |
| 86 |
if (status != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { \ |
| 87 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_CRITcxx . . $ `<external>/13723005323755402617/http_log.h:45:9`!, status, server, \ |
| 88 |
"%s", apr_strerror(status, errbuf, sizeof(errbuf))); \ |
| 89 |
} \ |
| 90 |
} \ |
| 91 |
} while (0) |
| 92 |
|
| 93 |
#define CACHE_UNLOCKcxx . . $ `mod_upload_progress.c:93:9`!() do { \ |
| 94 |
if (config->cache_lock) \ |
| 95 |
{ \ |
| 96 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "CACHE_UNLOCK()"); \ |
| 97 |
apr_global_mutex_unlock(config->cache_lock); \ |
| 98 |
} \ |
| 99 |
} while (0) |
| 100 |
|
| 101 |
typedef structcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0# { |
| 102 |
int track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled.; |
| 103 |
int report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled.; |
| 104 |
} DirConfigcxx . . $ DirConfig#; |
| 105 |
|
| 106 |
typedef struct upload_progress_node_scxx . . $ upload_progress_node_s#{ |
| 107 |
apr_off_tcxx . . $ apr_off_t# lengthcxx . . $ upload_progress_node_s#length.; |
| 108 |
apr_off_tcxx . . $ apr_off_t# receivedcxx . . $ upload_progress_node_s#received.; |
| 109 |
int err_statuscxx . . $ upload_progress_node_s#err_status.; |
| 110 |
time_tcxx . . $ time_t# started_atcxx . . $ upload_progress_node_s#started_at.; |
| 111 |
apr_off_tcxx . . $ apr_off_t# speedcxx . . $ upload_progress_node_s#speed.; /* bytes per second */ |
| 112 |
time_tcxx . . $ time_t# updated_atcxx . . $ upload_progress_node_s#updated_at.; |
| 113 |
int donecxx . . $ upload_progress_node_s#done.; |
| 114 |
char keycxx . . $ upload_progress_node_s#key.[ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!]; |
| 115 |
} upload_progress_node_tcxx . . $ upload_progress_node_t#; |
| 116 |
|
| 117 |
typedef structcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1# { |
| 118 |
apr_time_tcxx . . $ apr_time_t# cache_updated_atcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#cache_updated_at.; |
| 119 |
upload_progress_node_tcxx . . $ upload_progress_node_t# nodecxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#node.; |
| 120 |
} upload_progress_req_tcxx . . $ upload_progress_req_t#; |
| 121 |
|
| 122 |
typedef structcxx . . $ $anonymous_type_8e2c9acdfaecdcde_2# { |
| 123 |
int countcxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#count.; |
| 124 |
int activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.; |
| 125 |
} upload_progress_cache_tcxx . . $ upload_progress_cache_t#; |
| 126 |
|
| 127 |
typedef structcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3# { |
| 128 |
apr_global_mutex_tcxx . . $ apr_global_mutex_t# *cache_lockcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_lock.; |
| 129 |
char *lock_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#lock_file.; /* filename for shm lock mutex */ |
| 130 |
apr_size_tcxx . . $ apr_size_t# cache_bytescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_bytes.; |
| 131 |
apr_shm_tcxx . . $ apr_shm_t# *cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm.; |
| 132 |
char *cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file.; |
| 133 |
upload_progress_cache_tcxx . . $ upload_progress_cache_t# *cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.; |
| 134 |
int *listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list.; /* static array of node indexes, list begins with indexes of active nodes */ |
| 135 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes.; /* all nodes allocated at once */ |
| 136 |
} ServerConfigcxx . . $ ServerConfig#; |
| 137 |
|
| 138 |
static void upload_progress_cache_writecxx . . $ upload_progress_cache_write(30d2f028ad52d18e).(server_reccxx . . $ server_rec# *, upload_progress_node_tcxx . . $ upload_progress_node_t# *); |
| 139 |
static upload_progress_node_tcxx . . $ upload_progress_node_t# *find_nodecxx . . $ find_node(f1bb09bb88fd530d).(server_reccxx . . $ server_rec# *, const char *); |
| 140 |
static apr_status_tcxx . . $ apr_status_t# upload_progress_cleanupcxx . . $ upload_progress_cleanup(dedf1e9b1c614a07).(void *); |
| 141 |
static const char *get_progress_idcxx . . $ get_progress_id(8126f70efb5b1ecd).(request_reccxx . . $ request_rec# *, int *); |
| 142 |
|
| 143 |
extern modulecxx . . $ module# AP_MODULE_DECLARE_DATAcxx . . $ `<external>/10377806009144789469/ap_config.h:121:9`! upload_progress_modulecxx . . $ upload_progress_module.; |
| 144 |
|
| 145 |
static server_reccxx . . $ server_rec# *global_servercxx . . $ global_server. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 146 |
|
| 147 |
static inline ServerConfigcxx . . $ ServerConfig# *get_server_configcxx . . $ get_server_config(87acbf1853038100).(server_reccxx . . $ server_rec# *s) |
| 148 |
{ |
| 149 |
return (ServerConfigcxx . . $ ServerConfig# *)ap_get_module_configcxx . . $ `<external>/11954595451903284094/http_config.h:550:9`!(s->module_config, &upload_progress_module); |
| 150 |
} |
| 151 |
|
| 152 |
static inline DirConfigcxx . . $ DirConfig# *get_dir_configcxx . . $ get_dir_config(58acf1a171216e69).(request_reccxx . . $ request_rec# *r) |
| 153 |
{ |
| 154 |
return (DirConfigcxx . . $ DirConfig# *)ap_get_module_configcxx . . $ `<external>/11954595451903284094/http_config.h:550:9`!(r->per_dir_config, &upload_progress_module); |
| 155 |
} |
| 156 |
|
| 157 |
static inline upload_progress_req_tcxx . . $ upload_progress_req_t# *get_request_configcxx . . $ get_request_config(bd342c13b4c8bf5b).(request_reccxx . . $ request_rec# *r) |
| 158 |
{ |
| 159 |
return (upload_progress_req_tcxx . . $ upload_progress_req_t# *)ap_get_module_configcxx . . $ `<external>/11954595451903284094/http_config.h:550:9`!(r->request_config, &upload_progress_module); |
| 160 |
} |
| 161 |
|
| 162 |
|
| 163 |
static int upload_progress_handle_requestcxx . . $ upload_progress_handle_request(39a9a55d27f3cd8f).(request_reccxx . . $ request_rec# *r) |
| 164 |
{ |
| 165 |
server_reccxx . . $ server_rec# *server = r->servercxx . . $ request_rec#server.; |
| 166 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "upload_progress_handle_request()"); |
| 167 |
|
| 168 |
DirConfigcxx . . $ DirConfig# *dir = get_dir_configcxx . . $ get_dir_config(58acf1a171216e69).(r); |
| 169 |
|
| 170 |
if (!dir || (dir->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. <= 0)) { |
| 171 |
return DECLINEDcxx . . $ `<external>/2935095550947534277/httpd.h:461:9`!; |
| 172 |
} |
| 173 |
if (r->method_numbercxx . . $ request_rec#method_number. != M_POSTcxx . . $ `<external>/2935095550947534277/httpd.h:598:9`!) { |
| 174 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 175 |
"Upload Progress: Non-POST request in trackable location: %s.", r->uri); |
| 176 |
return DECLINEDcxx . . $ `<external>/2935095550947534277/httpd.h:461:9`!; |
| 177 |
} |
| 178 |
|
| 179 |
int param_error; |
| 180 |
const char *id = get_progress_idcxx . . $ get_progress_id(8126f70efb5b1ecd).(r, ¶m_error); |
| 181 |
|
| 182 |
if (id) { |
| 183 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 184 |
"Upload Progress: Upload id='%s' in trackable location: %s.", id, r->uri); |
| 185 |
|
| 186 |
upload_progress_req_tcxx . . $ upload_progress_req_t# *reqinfo = (upload_progress_req_tcxx . . $ upload_progress_req_t# *)apr_pcalloccxx . . $ `<external>/17224243006835857520/apr_pools.h:465:9`!(r->pool, |
| 187 |
sizeof(upload_progress_req_t)); |
| 188 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 189 |
if (reqinfo) { |
| 190 |
reqinfo->cache_updated_atcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#cache_updated_at. = apr_time_nowcxx . . $ apr_time_now(da6335ded91d79c2).(); |
| 191 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node = &(reqinfo->nodecxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#node.); |
| 192 |
|
| 193 |
strncpycxx . . $ strncpy(255158a415b673b0).(node->keycxx . . $ upload_progress_node_s#key., id, ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!); |
| 194 |
time_tcxx . . $ time_t# t = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 195 |
|
| 196 |
node->receivedcxx . . $ upload_progress_node_s#received. = 0; |
| 197 |
node->donecxx . . $ upload_progress_node_s#done. = 0; |
| 198 |
node->err_statuscxx . . $ upload_progress_node_s#err_status. = 0; |
| 199 |
node->started_atcxx . . $ upload_progress_node_s#started_at. = t; |
| 200 |
node->speedcxx . . $ upload_progress_node_s#speed. = 0; |
| 201 |
node->updated_atcxx . . $ upload_progress_node_s#updated_at. = t; |
| 202 |
const char *content_length = apr_table_getcxx . . $ apr_table_get(d23bdb53f0ac937e).(r->headers_incxx . . $ request_rec#headers_in., "Content-Length"); |
| 203 |
node->lengthcxx . . $ upload_progress_node_s#length. = 1; |
| 204 |
/* Content-Length is missing is case of chunked transfer encoding */ |
| 205 |
if (content_length) |
| 206 |
sscanfcxx . . $ sscanf(5e8a2c12db2ea735).(content_length, "%" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`!, &(node->lengthcxx . . $ upload_progress_node_s#length.)); |
| 207 |
} |
| 208 |
|
| 209 |
ap_set_module_configcxx . . $ `<external>/11954595451903284094/http_config.h:552:9`!(r->request_config, &upload_progress_module, reqinfo); |
| 210 |
apr_pool_cleanup_registercxx . . $ apr_pool_cleanup_register(5659e5f5dd04763).(r->poolcxx . . $ request_rec#pool., r, upload_progress_cleanupcxx . . $ upload_progress_cleanup(dedf1e9b1c614a07)., apr_pool_cleanup_nullcxx . . $ apr_pool_cleanup_null(dedf1e9b1c614a07).); |
| 211 |
ap_add_input_filtercxx . . $ ap_add_input_filter(79c712dc33c07188).("UPLOAD_PROGRESS", NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, r, r->connectioncxx . . $ request_rec#connection.); |
| 212 |
|
| 213 |
upload_progress_cache_writecxx . . $ upload_progress_cache_write(30d2f028ad52d18e).(server, node); |
| 214 |
|
| 215 |
} else if (param_error < 0) { |
| 216 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 217 |
"Upload Progress: Upload with invalid ID in trackable location: %s.", r->uri); |
| 218 |
/* |
| 219 |
return HTTP_BAD_REQUEST; |
| 220 |
return HTTP_NOT_FOUND; |
| 221 |
*/ |
| 222 |
|
| 223 |
} else { |
| 224 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 225 |
"Upload Progress: Upload without ID in trackable location: %s.", r->uri); |
| 226 |
} |
| 227 |
|
| 228 |
return DECLINEDcxx . . $ `<external>/2935095550947534277/httpd.h:461:9`!; |
| 229 |
} |
| 230 |
|
| 231 |
static const char *report_upload_progress_cmdcxx . . $ report_upload_progress_cmd(812ce6223da7342d).(cmd_parmscxx . . $ cmd_parms# *cmd, void *config, int arg) |
| 232 |
{ |
| 233 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "report_upload_progress_cmd()"); |
| 234 |
DirConfigcxx . . $ DirConfig# *dir = (DirConfigcxx . . $ DirConfig# *)config; |
| 235 |
dir->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. = arg ? 1 : -1; |
| 236 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 237 |
} |
| 238 |
|
| 239 |
static const char *track_upload_progress_cmdcxx . . $ track_upload_progress_cmd(812ce6223da7342d).(cmd_parmscxx . . $ cmd_parms# *cmd, void *config, int arg) |
| 240 |
{ |
| 241 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "track_upload_progress_cmd()"); |
| 242 |
DirConfigcxx . . $ DirConfig# *dir = (DirConfigcxx . . $ DirConfig# *)config; |
| 243 |
dir->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. = arg ? 1 : -1; |
| 244 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 245 |
} |
| 246 |
|
| 247 |
static const char* upload_progress_shared_memory_size_cmdcxx . . $ upload_progress_shared_memory_size_cmd(acbe0066e605e51d).(cmd_parmscxx . . $ cmd_parms# *cmd, |
| 248 |
void *dummy, const char *arg) |
| 249 |
{ |
| 250 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "upload_progress_shared_memory_size_cmd()"); |
| 251 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(cmd->servercxx . . $ cmd_parms_struct#server.); |
| 252 |
|
| 253 |
long long int n = atoicxx . . $ atoi(5c4306d8553b3696).(arg); |
| 254 |
|
| 255 |
if (n <= 0) { |
| 256 |
return "UploadProgressSharedMemorySize should be positive"; |
| 257 |
} |
| 258 |
|
| 259 |
config->cache_bytescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_bytes. = (apr_size_tcxx . . $ apr_size_t#)n; |
| 260 |
|
| 261 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 262 |
} |
| 263 |
|
| 264 |
static void *upload_progress_create_dir_configcxx . . $ upload_progress_create_dir_config(ed769dc40819ee9f).(apr_pool_tcxx . . $ apr_pool_t# *p, char *dirspec) |
| 265 |
{ |
| 266 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "upload_progress_create_dir_config()"); |
| 267 |
DirConfigcxx . . $ DirConfig# *dir = (DirConfigcxx . . $ DirConfig# *)apr_pcalloccxx . . $ `<external>/17224243006835857520/apr_pools.h:465:9`!(p, sizeof(DirConfig)); |
| 268 |
dir->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. = 0; |
| 269 |
dir->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. = 0; |
| 270 |
return dir; |
| 271 |
} |
| 272 |
|
| 273 |
static void *upload_progress_merge_dir_configcxx . . $ upload_progress_merge_dir_config(32947ac650ccaa82).(apr_pool_tcxx . . $ apr_pool_t# *p, void *basev, void *overridev) |
| 274 |
{ |
| 275 |
DirConfigcxx . . $ DirConfig# *new = (DirConfigcxx . . $ DirConfig# *)apr_pcalloccxx . . $ `<external>/17224243006835857520/apr_pools.h:465:9`!(p, sizeof(DirConfig)); |
| 276 |
DirConfigcxx . . $ DirConfig# *override = (DirConfigcxx . . $ DirConfig# *)overridev; |
| 277 |
DirConfigcxx . . $ DirConfig# *base = (DirConfigcxx . . $ DirConfig# *)basev; |
| 278 |
new->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. = (override->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. == 0) ? base->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. : |
| 279 |
(override->track_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#track_enabled. > 0 ? 1 : -1); |
| 280 |
new->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. = (override->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. == 0) ? base->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. : |
| 281 |
(override->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. > 0 ? 1 : -1); |
| 282 |
return new; |
| 283 |
} |
| 284 |
|
| 285 |
static void *upload_progress_create_server_configcxx . . $ upload_progress_create_server_config(dd4397821956b594).(apr_pool_tcxx . . $ apr_pool_t# *p, server_reccxx . . $ server_rec# *s) |
| 286 |
{ |
| 287 |
if (!global_servercxx . . $ global_server.) global_servercxx . . $ global_server. = s; |
| 288 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "upload_progress_create_server_config()"); |
| 289 |
ServerConfigcxx . . $ ServerConfig# *config = (ServerConfigcxx . . $ ServerConfig# *)apr_pcalloccxx . . $ `<external>/17224243006835857520/apr_pools.h:465:9`!(p, sizeof(ServerConfig)); |
| 290 |
config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file. = apr_pstrdupcxx . . $ apr_pstrdup(89bbe4b0fcbcaedb).(p, CACHE_FILENAMEcxx . . $ `mod_upload_progress.c:33:11`!); |
| 291 |
config->cache_bytescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_bytes. = 51200; |
| 292 |
return config; |
| 293 |
} |
| 294 |
|
| 295 |
static void *upload_progress_merge_server_configcxx . . $ upload_progress_merge_server_config(32947ac650ccaa82).(apr_pool_tcxx . . $ apr_pool_t# *p, void *basev, |
| 296 |
void *overridesv) |
| 297 |
{ |
| 298 |
return basev; |
| 299 |
} |
| 300 |
|
| 301 |
static int read_request_statuscxx . . $ read_request_status(39a9a55d27f3cd8f).(request_reccxx . . $ request_rec# *r) |
| 302 |
{ |
| 303 |
int status; |
| 304 |
|
| 305 |
if (r) { |
| 306 |
/* error status rendered in status line is preferred because passenger |
| 307 |
clobbers request_rec->status when exception occurs */ |
| 308 |
/* FIXME: Shouldn't we read r->status instead as it's already preparsed? */ |
| 309 |
status = r->status_linecxx . . $ request_rec#status_line. ? atoicxx . . $ atoi(5c4306d8553b3696).(r->status_linecxx . . $ request_rec#status_line.) : 0; |
| 310 |
if (!ap_is_HTTP_VALID_RESPONSEcxx . . $ `<external>/2935095550947534277/httpd.h:564:9`!(status)) |
| 311 |
status = r->statuscxx . . $ request_rec#status.; |
| 312 |
return status; |
| 313 |
} else { |
| 314 |
return 0; |
| 315 |
} |
| 316 |
} |
| 317 |
|
| 318 |
static int track_upload_progresscxx . . $ track_upload_progress(f776fa97e01bf86a).(ap_filter_tcxx . . $ ap_filter_t# *f, apr_bucket_brigadecxx . . $ apr_bucket_brigade# *bb, |
| 319 |
ap_input_mode_tcxx . . $ ap_input_mode_t# mode, apr_read_type_ecxx . . $ apr_read_type_e# block, |
| 320 |
apr_off_tcxx . . $ apr_off_t# readbytes) |
| 321 |
{ |
| 322 |
server_reccxx . . $ server_rec# *server = f->rcxx . . $ ap_filter_t#r.->servercxx . . $ request_rec#server.; |
| 323 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "track_upload_progress()"); |
| 324 |
|
| 325 |
apr_status_tcxx . . $ apr_status_t# rv = ap_get_brigadecxx . . $ ap_get_brigade(f776fa97e01bf86a).(f->nextcxx . . $ ap_filter_t#next., bb, mode, block, readbytes); |
| 326 |
|
| 327 |
upload_progress_req_tcxx . . $ upload_progress_req_t# *reqinfo = get_request_configcxx . . $ get_request_config(bd342c13b4c8bf5b).(f->rcxx . . $ ap_filter_t#r.); |
| 328 |
if (!reqinfo) { |
| 329 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "Request config not available"); |
| 330 |
return rv; |
| 331 |
} |
| 332 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node = &(reqinfo->nodecxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#node.); |
| 333 |
|
| 334 |
time_tcxx . . $ time_t# t = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 335 |
node->updated_atcxx . . $ upload_progress_node_s#updated_at. = t; |
| 336 |
if (rv == APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 337 |
apr_off_tcxx . . $ apr_off_t# length; |
| 338 |
apr_brigade_lengthcxx . . $ apr_brigade_length(82b0b74519652ad3).(bb, 1, &length); |
| 339 |
node->receivedcxx . . $ upload_progress_node_s#received. += length; |
| 340 |
if (node->receivedcxx . . $ upload_progress_node_s#received. > node->lengthcxx . . $ upload_progress_node_s#length.) /* handle chunked transfer */ |
| 341 |
node->lengthcxx . . $ upload_progress_node_s#length. = node->receivedcxx . . $ upload_progress_node_s#received.; |
| 342 |
int upload_time = t - node->started_atcxx . . $ upload_progress_node_s#started_at.; |
| 343 |
if (upload_time > 0) { |
| 344 |
node->speedcxx . . $ upload_progress_node_s#speed. = node->receivedcxx . . $ upload_progress_node_s#received. / upload_time; |
| 345 |
} |
| 346 |
} else { |
| 347 |
node->err_statuscxx . . $ upload_progress_node_s#err_status. = read_request_statuscxx . . $ read_request_status(39a9a55d27f3cd8f).(f->rcxx . . $ ap_filter_t#r.); |
| 348 |
reqinfo->cache_updated_atcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#cache_updated_at. = 0; /* force cache update */ |
| 349 |
} |
| 350 |
|
| 351 |
apr_time_tcxx . . $ apr_time_t# now = apr_time_nowcxx . . $ apr_time_now(da6335ded91d79c2).(); |
| 352 |
if ((now - reqinfo->cache_updated_atcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#cache_updated_at.) > apr_time_from_mseccxx . . $ `<external>/3921411045222706442/apr_time.h:75:9`!(500)) { |
| 353 |
reqinfo->cache_updated_atcxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#cache_updated_at. = now; |
| 354 |
upload_progress_cache_writecxx . . $ upload_progress_cache_write(30d2f028ad52d18e).(server, node); |
| 355 |
} |
| 356 |
|
| 357 |
return rv; |
| 358 |
} |
| 359 |
|
| 360 |
static int check_request_argumentcxx . . $ check_request_argument(9514cfe36214ae9b).(const char *value, int len, char *allowed, int minlen, int maxlen) { |
| 361 |
/* Check the length of the argument */ |
| 362 |
if (len > maxlen) return -1; |
| 363 |
if (len < minlen) return -2; |
| 364 |
/* If no whitelist given, assume everything whitelisted */ |
| 365 |
if (!allowed) return 0; |
| 366 |
/* Check each char to be in the whitelist */ |
| 367 |
if (strspncxx . . $ strspn(335c1dc86f5c867f).(value, allowed) < len) return -3; |
| 368 |
return 0; |
| 369 |
} |
| 370 |
|
| 371 |
static char *get_param_valuecxx . . $ get_param_value(57c55322c85873fe).(char *p, const char *param_name, int *len) { |
| 372 |
char pn1[3] = {touppercxx . . $ `<external>/17904084882347303253/ctype.h:221:11`!(param_name[0]), tolowercxx . . $ `<external>/17904084882347303253/ctype.h:220:11`!(param_name[0]), 0}; |
| 373 |
int pn_len = strlencxx . . $ strlen(751346f8406fd082).(param_name); |
| 374 |
char *val_end; |
| 375 |
static char *param_sep = "&"; |
| 376 |
|
| 377 |
while (p) { |
| 378 |
if ((strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(p, param_name, pn_len) == 0) && (p[pn_len] == '=')) |
| 379 |
break; |
| 380 |
if (*p) p++; |
| 381 |
p = strpbrkcxx . . $ strpbrk(a713fe7b9a57cf96).(p, pn1); |
| 382 |
} |
| 383 |
if (p) { |
| 384 |
p += (pn_len + 1); |
| 385 |
*len = strcspncxx . . $ strcspn(335c1dc86f5c867f).(p, param_sep); |
| 386 |
} |
| 387 |
return p; |
| 388 |
} |
| 389 |
|
| 390 |
static const char *get_progress_idcxx . . $ get_progress_id(8126f70efb5b1ecd).(request_reccxx . . $ request_rec# *r, int *param_error) { |
| 391 |
int len; |
| 392 |
|
| 393 |
/* try to find progress id in http headers */ |
| 394 |
const char *id = apr_table_getcxx . . $ apr_table_get(d23bdb53f0ac937e).(r->headers_incxx . . $ request_rec#headers_in., PROGRESS_IDcxx . . $ `mod_upload_progress.c:27:11`!); |
| 395 |
if (id) { |
| 396 |
*param_error = check_request_argumentcxx . . $ check_request_argument(9514cfe36214ae9b).(id, strlencxx . . $ strlen(751346f8406fd082).(id), ARG_ALLOWED_PROGRESSIDcxx . . $ `mod_upload_progress.c:45:11`!, |
| 397 |
ARG_MINLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:51:11`!, ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!); |
| 398 |
if (*param_error) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 399 |
return id; |
| 400 |
} |
| 401 |
|
| 402 |
/* if progress id not found in headers, check request args (query string) */ |
| 403 |
id = get_param_valuecxx . . $ get_param_value(57c55322c85873fe).(r->argscxx . . $ request_rec#args., PROGRESS_IDcxx . . $ `mod_upload_progress.c:27:11`!, &len); |
| 404 |
if (id) { |
| 405 |
*param_error = check_request_argumentcxx . . $ check_request_argument(9514cfe36214ae9b).(id, len, ARG_ALLOWED_PROGRESSIDcxx . . $ `mod_upload_progress.c:45:11`!, |
| 406 |
ARG_MINLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:51:11`!, ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!); |
| 407 |
if (*param_error) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 408 |
return apr_pstrndupcxx . . $ apr_pstrndup(dbd04c9119248273).(r->connectioncxx . . $ request_rec#connection.->poolcxx . . $ conn_rec#pool., id, len); |
| 409 |
} |
| 410 |
|
| 411 |
*param_error = 1; /* not found */ |
| 412 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 413 |
} |
| 414 |
|
| 415 |
static const char *get_json_callback_paramcxx . . $ get_json_callback_param(8126f70efb5b1ecd).(request_reccxx . . $ request_rec# *r, int *param_error) { |
| 416 |
char *val; |
| 417 |
int len; |
| 418 |
|
| 419 |
val = get_param_valuecxx . . $ get_param_value(57c55322c85873fe).(r->argscxx . . $ request_rec#args., JSON_CB_PARAMcxx . . $ `mod_upload_progress.c:30:11`!, &len); |
| 420 |
if (val) { |
| 421 |
*param_error = check_request_argumentcxx . . $ check_request_argument(9514cfe36214ae9b).(val, len, ARG_ALLOWED_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:48:11`!, |
| 422 |
ARG_MINLEN_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:60:11`!, ARG_MAXLEN_JSONPCALLBACKcxx . . $ `mod_upload_progress.c:64:11`!); |
| 423 |
if (*param_error) return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 424 |
return apr_pstrndupcxx . . $ apr_pstrndup(dbd04c9119248273).(r->connectioncxx . . $ request_rec#connection.->poolcxx . . $ conn_rec#pool., val, len); |
| 425 |
} |
| 426 |
|
| 427 |
*param_error = 1; /* not found */ |
| 428 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 429 |
} |
| 430 |
|
| 431 |
static inline int check_nodecxx . . $ check_node(1dfb58b82db9a9da).(upload_progress_node_tcxx . . $ upload_progress_node_t# *node, const char *key) { |
| 432 |
return ((node) && (strncasecmpcxx . . $ strncasecmp(fd278af2f295fa2e).(node->keycxx . . $ upload_progress_node_s#key., key, ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!) == 0)) ? 1 : 0; |
| 433 |
} |
| 434 |
|
| 435 |
static upload_progress_node_tcxx . . $ upload_progress_node_t# *find_nodecxx . . $ find_node(f1bb09bb88fd530d).(server_reccxx . . $ server_rec# *server, const char *key) { |
| 436 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "find_node()"); |
| 437 |
|
| 438 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(server); |
| 439 |
upload_progress_cache_tcxx . . $ upload_progress_cache_t# *cache = config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.; |
| 440 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node, *nodes = config->nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes.; |
| 441 |
int *list = config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list.; |
| 442 |
int active = cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.; |
| 443 |
int i; |
| 444 |
|
| 445 |
for (i = 0; i < active; i++) { |
| 446 |
node = &nodes[list[i]]; |
| 447 |
if (check_nodecxx . . $ check_node(1dfb58b82db9a9da).(node, key)) |
| 448 |
return node; |
| 449 |
} |
| 450 |
return NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!; |
| 451 |
} |
| 452 |
|
| 453 |
static apr_status_tcxx . . $ apr_status_t# upload_progress_cleanupcxx . . $ upload_progress_cleanup(dedf1e9b1c614a07).(void *data) |
| 454 |
{ |
| 455 |
request_reccxx . . $ request_rec# *r = (request_reccxx . . $ request_rec# *)data; |
| 456 |
server_reccxx . . $ server_rec# *server = r->servercxx . . $ request_rec#server.; |
| 457 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "upload_progress_cleanup()"); |
| 458 |
|
| 459 |
upload_progress_req_tcxx . . $ upload_progress_req_t# *reqinfo = get_request_configcxx . . $ get_request_config(bd342c13b4c8bf5b).(r); |
| 460 |
if (!reqinfo) { |
| 461 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "Request config not available"); |
| 462 |
return APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!; |
| 463 |
} |
| 464 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node = &(reqinfo->nodecxx . . $ $anonymous_type_8e2c9acdfaecdcde_1#node.); |
| 465 |
node->err_statuscxx . . $ upload_progress_node_s#err_status. = read_request_statuscxx . . $ read_request_status(39a9a55d27f3cd8f).(r); |
| 466 |
node->updated_atcxx . . $ upload_progress_node_s#updated_at. = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 467 |
node->donecxx . . $ upload_progress_node_s#done. = 1; |
| 468 |
upload_progress_cache_writecxx . . $ upload_progress_cache_write(30d2f028ad52d18e).(server, node); |
| 469 |
|
| 470 |
return APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!; |
| 471 |
} |
| 472 |
|
| 473 |
static void upload_progress_cache_writecxx . . $ upload_progress_cache_write(30d2f028ad52d18e).(server_reccxx . . $ server_rec# *server, upload_progress_node_tcxx . . $ upload_progress_node_t# *new_data) |
| 474 |
{ |
| 475 |
if (!new_data) return; |
| 476 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(server); |
| 477 |
|
| 478 |
CACHE_LOCKcxx . . $ `mod_upload_progress.c:81:9`!(); |
| 479 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *node = find_nodecxx . . $ find_node(f1bb09bb88fd530d).(server, new_data->keycxx . . $ upload_progress_node_s#key.); |
| 480 |
time_tcxx . . $ time_t# now = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 481 |
#define EXPIREDcxx . . $ `mod_upload_progress.c:481:9`!(node,now) ((now - node->updated_at) > PROGRESS_EXPIREScxx . . $ `mod_upload_progress.c:38:11`!) |
| 482 |
if (node) { |
| 483 |
/* reuse node if: request finished, expired, or same started_at as node */ |
| 484 |
if (node->started_atcxx . . $ upload_progress_node_s#started_at. == new_data->started_atcxx . . $ upload_progress_node_s#started_at. || node->donecxx . . $ upload_progress_node_s#done. || EXPIREDcxx . . $ `mod_upload_progress.c:481:9`!(node, now)) { |
| 485 |
memcpycxx . . $ memcpy(cc817cb175f282d).(node, new_data, sizeof(upload_progress_node_tcxx . . $ upload_progress_node_t#)); |
| 486 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, |
| 487 |
"Upload Progress: Reused existing node with id='%" UP_ID_FMT "'.", node->key); |
| 488 |
} else { |
| 489 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 490 |
"Upload Progress: Upload with id='%" UP_ID_FMTcxx . . $ `mod_upload_progress.c:58:9`! "' already exists, ignoring.", node->key); |
| 491 |
} |
| 492 |
} else { |
| 493 |
|
| 494 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "cleaning expired cache nodes"); |
| 495 |
|
| 496 |
upload_progress_cache_tcxx . . $ upload_progress_cache_t# *cache = config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.; |
| 497 |
upload_progress_node_tcxx . . $ upload_progress_node_t# *nodes = config->nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes.; |
| 498 |
int *list = config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list.; |
| 499 |
int i, tmp; |
| 500 |
|
| 501 |
/* check active nodes list, if expired node found |
| 502 |
then swap it with last active and shrink active list by one */ |
| 503 |
for (i = 0; i < cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.; i++) { |
| 504 |
node = &nodes[list[i]]; |
| 505 |
if (EXPIREDcxx . . $ `mod_upload_progress.c:481:9`!(node, now)) { |
| 506 |
cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active. -= 1; |
| 507 |
tmp = list[cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.]; |
| 508 |
list[cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.] = list[i]; |
| 509 |
list[i] = tmp; |
| 510 |
i--; |
| 511 |
} |
| 512 |
} |
| 513 |
|
| 514 |
if (cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active. < cache->countcxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#count.) { |
| 515 |
node = &config->nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes.[config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list.[cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active.]]; |
| 516 |
cache->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active. += 1; |
| 517 |
memcpycxx . . $ memcpy(cc817cb175f282d).(node, new_data, sizeof(upload_progress_node_tcxx . . $ upload_progress_node_t#)); |
| 518 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, |
| 519 |
"Upload Progress: Added upload with id='%" UP_ID_FMT "' to list.", node->key); |
| 520 |
} else { |
| 521 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, "Cache full"); |
| 522 |
} |
| 523 |
|
| 524 |
} |
| 525 |
CACHE_UNLOCKcxx . . $ `mod_upload_progress.c:93:9`!(); |
| 526 |
|
| 527 |
} |
| 528 |
|
| 529 |
static apr_status_tcxx . . $ apr_status_t# upload_progress_cache_initcxx . . $ upload_progress_cache_init(29ea2cbd8fb5d1e8).(apr_pool_tcxx . . $ apr_pool_t# *pool, ServerConfigcxx . . $ ServerConfig# *config) |
| 530 |
{ |
| 531 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "upload_progress_cache_init()"); |
| 532 |
|
| 533 |
apr_status_tcxx . . $ apr_status_t# result; |
| 534 |
apr_size_tcxx . . $ apr_size_t# size; |
| 535 |
int nodes_cnt, i; |
| 536 |
|
| 537 |
if (config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file.) { |
| 538 |
/* Remove any existing shm segment with this name. */ |
| 539 |
apr_shm_removecxx . . $ apr_shm_remove(2c79afc3db550738).(config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file., pool); |
| 540 |
unlinkcxx . . $ unlink(5c4306d8553b3696).(config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file.); |
| 541 |
} |
| 542 |
|
| 543 |
size = APR_ALIGN_DEFAULTcxx . . $ `<external>/244091220166111228/apr_general.h:147:9`!(config->cache_bytes); |
| 544 |
result = apr_shm_createcxx . . $ apr_shm_create(f47099851e370b3d).(&config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm., size, config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file., pool); |
| 545 |
if (result != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 546 |
return result; |
| 547 |
} |
| 548 |
|
| 549 |
/* Determine the usable size of the shm segment. */ |
| 550 |
size = apr_shm_size_getcxx . . $ apr_shm_size_get(29924e4e69104cf9).(config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm.); |
| 551 |
nodes_cnt = (size - sizeof(upload_progress_cache_tcxx . . $ upload_progress_cache_t#)) / |
| 552 |
(sizeof(int) + sizeof(upload_progress_node_tcxx . . $ upload_progress_node_t#)); |
| 553 |
|
| 554 |
/* init cache */ |
| 555 |
config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache. = (upload_progress_cache_tcxx . . $ upload_progress_cache_t# *)apr_shm_baseaddr_getcxx . . $ apr_shm_baseaddr_get(2c50495116e9fd92).(config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm.); |
| 556 |
config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list. = (int *)(config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache. + 1); |
| 557 |
config->nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes. = (upload_progress_node_tcxx . . $ upload_progress_node_t# *)(config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list. + nodes_cnt); |
| 558 |
config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.->countcxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#count. = nodes_cnt; |
| 559 |
config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.->activecxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#active. = 0; |
| 560 |
for (i = 0; i < nodes_cnt; i++) config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list.[i] = i; |
| 561 |
|
| 562 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_INFOcxx . . $ `<external>/13723005323755402617/http_log.h:49:9`!, 0, global_server, |
| 563 |
"Upload Progress: monitoring max %i simultaneous uploads, id (%s) length %i..%i", |
| 564 |
nodes_cnt, PROGRESS_IDcxx . . $ `mod_upload_progress.c:27:11`!, ARG_MINLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:51:11`!, ARG_MAXLEN_PROGRESSIDcxx . . $ `mod_upload_progress.c:54:11`!); |
| 565 |
|
| 566 |
return APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!; |
| 567 |
} |
| 568 |
|
| 569 |
static int upload_progress_initcxx . . $ upload_progress_init(22b9b64173c7cc4e).(apr_pool_tcxx . . $ apr_pool_t# *p, apr_pool_tcxx . . $ apr_pool_t# *plog, |
| 570 |
apr_pool_tcxx . . $ apr_pool_t# *ptemp, |
| 571 |
server_reccxx . . $ server_rec# *s) { |
| 572 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, s, "upload_progress_init()"); |
| 573 |
|
| 574 |
apr_status_tcxx . . $ apr_status_t# result; |
| 575 |
|
| 576 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(s); |
| 577 |
|
| 578 |
void *data; |
| 579 |
const char *userdata_key = "upload_progress_init"; |
| 580 |
|
| 581 |
/* upload_progress_init will be called twice. Don't bother |
| 582 |
* going through all of the initialization on the first call |
| 583 |
* because it will just be thrown away.*/ |
| 584 |
apr_pool_userdata_getcxx . . $ apr_pool_userdata_get(217ea2af4261c05a).(&data, userdata_key, s->processcxx . . $ server_rec#process.->poolcxx . . $ process_rec#pool.); |
| 585 |
if (!data) { |
| 586 |
apr_pool_userdata_setcxx . . $ apr_pool_userdata_set(1a377c4d920ba7c).((const void *)1, userdata_key, |
| 587 |
apr_pool_cleanup_nullcxx . . $ apr_pool_cleanup_null(dedf1e9b1c614a07)., s->processcxx . . $ server_rec#process.->poolcxx . . $ process_rec#pool.); |
| 588 |
|
| 589 |
/* If the cache file already exists then delete it. Otherwise we are |
| 590 |
* going to run into problems creating the shared memory. */ |
| 591 |
if (config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file.) { |
| 592 |
char *lck_file = apr_pstrcatcxx . . $ apr_pstrcat(90332950cb98ff31).(ptemp, config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file., ".lck", |
| 593 |
NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 594 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, s, "Upload Progress: Remove lock file"); |
| 595 |
apr_file_removecxx . . $ apr_file_remove(2c79afc3db550738).(lck_file, ptemp); |
| 596 |
} |
| 597 |
return OKcxx . . $ `<external>/2935095550947534277/httpd.h:460:9`!; |
| 598 |
} |
| 599 |
|
| 600 |
/* initializing cache if shared memory size is not zero and we already |
| 601 |
* don't have shm address |
| 602 |
*/ |
| 603 |
if (!config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm. && config->cache_bytescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_bytes. > 0) { |
| 604 |
result = upload_progress_cache_initcxx . . $ upload_progress_cache_init(29ea2cbd8fb5d1e8).(p, config); |
| 605 |
if (result != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 606 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_ERRcxx . . $ `<external>/13723005323755402617/http_log.h:46:9`!, result, s, |
| 607 |
"Upload Progress cache: could not create shared memory segment"); |
| 608 |
return DONEcxx . . $ `<external>/2935095550947534277/httpd.h:462:9`!; |
| 609 |
} |
| 610 |
|
| 611 |
if (config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file.) { |
| 612 |
config->lock_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#lock_file. = apr_pstrcatcxx . . $ apr_pstrcat(90332950cb98ff31).(p, config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file., ".lck", |
| 613 |
NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 614 |
} |
| 615 |
|
| 616 |
result = apr_global_mutex_createcxx . . $ apr_global_mutex_create(83fbf57a0e6347bc).(&config->cache_lockcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_lock., |
| 617 |
config->lock_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#lock_file., APR_LOCK_DEFAULTcxx . . $ APR_LOCK_DEFAULT., |
| 618 |
p); |
| 619 |
if (result != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 620 |
return result; |
| 621 |
} |
| 622 |
|
| 623 |
#ifdef AP_NEED_SET_MUTEX_PERMScxx . . $ `<external>/4466667618001265109/os.h:41:9`! |
| 624 |
result = ap_unixd_set_global_mutex_permscxx . . $ ap_unixd_set_global_mutex_perms(7189afdb9e78ceb7).(config->cache_lockcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_lock.); |
| 625 |
if (result != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 626 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_CRITcxx . . $ `<external>/13723005323755402617/http_log.h:45:9`!, result, s, |
| 627 |
"Upload progress cache: failed to set mutex permissions"); |
| 628 |
return result; |
| 629 |
} |
| 630 |
#endif |
| 631 |
|
| 632 |
} else { |
| 633 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, s, |
| 634 |
"Upload Progress cache: cache size is zero, disabling " |
| 635 |
"shared memory cache"); |
| 636 |
} |
| 637 |
|
| 638 |
return(OKcxx . . $ `<external>/2935095550947534277/httpd.h:460:9`!); |
| 639 |
} |
| 640 |
|
| 641 |
static int reportuploads_handlercxx . . $ reportuploads_handler(39a9a55d27f3cd8f).(request_reccxx . . $ request_rec# *r) |
| 642 |
{ |
| 643 |
server_reccxx . . $ server_rec# *server = r->servercxx . . $ request_rec#server.; |
| 644 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, "reportuploads_handler()"); |
| 645 |
|
| 646 |
upload_progress_node_tcxx . . $ upload_progress_node_t# upload, *found; |
| 647 |
int param_error; |
| 648 |
char *response; |
| 649 |
DirConfigcxx . . $ DirConfig# *dir = get_dir_configcxx . . $ get_dir_config(58acf1a171216e69).(r); |
| 650 |
|
| 651 |
if (!dir || (dir->report_enabledcxx . . $ $anonymous_type_8e2c9acdfaecdcde_0#report_enabled. <= 0)) { |
| 652 |
return DECLINEDcxx . . $ `<external>/2935095550947534277/httpd.h:461:9`!; |
| 653 |
} |
| 654 |
if (r->method_numbercxx . . $ request_rec#method_number. != M_GETcxx . . $ `<external>/2935095550947534277/httpd.h:596:9`!) { |
| 655 |
return HTTP_METHOD_NOT_ALLOWEDcxx . . $ `<external>/2935095550947534277/httpd.h:517:9`!; |
| 656 |
} |
| 657 |
|
| 658 |
/* get the tracking id if any */ |
| 659 |
const char *id = get_progress_idcxx . . $ get_progress_id(8126f70efb5b1ecd).(r, ¶m_error); |
| 660 |
|
| 661 |
if (id == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!) { |
| 662 |
if (param_error < 0) { |
| 663 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_INFOcxx . . $ `<external>/13723005323755402617/http_log.h:49:9`!, 0, server, |
| 664 |
"Upload Progress: Report requested with invalid id. uri=%s", r->uri); |
| 665 |
return HTTP_BAD_REQUESTcxx . . $ `<external>/2935095550947534277/httpd.h:512:9`!; |
| 666 |
} else { |
| 667 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 668 |
"Upload Progress: Report requested without id. uri=%s", r->uri); |
| 669 |
return HTTP_NOT_FOUNDcxx . . $ `<external>/2935095550947534277/httpd.h:516:9`!; |
| 670 |
} |
| 671 |
} |
| 672 |
|
| 673 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_DEBUGcxx . . $ `<external>/13723005323755402617/http_log.h:50:9`!, 0, server, |
| 674 |
"Upload Progress: Report requested with id='%s'. uri=%s", id, r->uri); |
| 675 |
|
| 676 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(server); |
| 677 |
|
| 678 |
CACHE_LOCKcxx . . $ `mod_upload_progress.c:81:9`!(); |
| 679 |
found = find_nodecxx . . $ find_node(f1bb09bb88fd530d).(server, id); |
| 680 |
if (found) { |
| 681 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, |
| 682 |
"Node with id=%s found for report", id); |
| 683 |
memcpycxx . . $ memcpy(cc817cb175f282d).(&upload, found, sizeof(upload)); |
| 684 |
} else { |
| 685 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, |
| 686 |
"Node with id=%s not found for report", id); |
| 687 |
} |
| 688 |
CACHE_UNLOCKcxx . . $ `mod_upload_progress.c:93:9`!(); |
| 689 |
|
| 690 |
ap_set_content_typecxx . . $ ap_set_content_type(3473b54cd42fe478).(r, "application/json"); |
| 691 |
|
| 692 |
apr_table_setcxx . . $ apr_table_set(410ab61a581a93d8).(r->headers_outcxx . . $ request_rec#headers_out., "Expires", "Mon, 28 Sep 1970 06:00:00 GMT"); |
| 693 |
apr_table_setcxx . . $ apr_table_set(410ab61a581a93d8).(r->headers_outcxx . . $ request_rec#headers_out., "Cache-Control", "no-cache"); |
| 694 |
|
| 695 |
/* There are 4 possibilities |
| 696 |
* request not yet started: found = false |
| 697 |
* request in error: err_status >= NGX_HTTP_SPECIAL_RESPONSE |
| 698 |
* request finished: done = true |
| 699 |
* request not yet started but registered: length==0 && rest ==0 |
| 700 |
* request in progress: rest > 0 |
| 701 |
*/ |
| 702 |
|
| 703 |
if (!found) { |
| 704 |
response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "{ \"state\" : \"starting\", \"uuid\" : \"%s\" }", id); |
| 705 |
} else if (upload.err_statuscxx . . $ upload_progress_node_s#err_status. >= HTTP_BAD_REQUESTcxx . . $ `<external>/2935095550947534277/httpd.h:512:9`! ) { |
| 706 |
response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "{ " |
| 707 |
"\"state\": \"error\", " |
| 708 |
"\"status\": %d, " |
| 709 |
"\"uuid\": \"%s\" " |
| 710 |
"}", upload.err_statuscxx . . $ upload_progress_node_s#err_status., id); |
| 711 |
} else if (upload.donecxx . . $ upload_progress_node_s#done.) { |
| 712 |
response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "{ " |
| 713 |
"\"state\": \"done\", " |
| 714 |
"\"size\": %" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`! ", " |
| 715 |
"\"speed\": %" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`! ", " |
| 716 |
"\"started_at\": %li, " |
| 717 |
"\"completed_at\": %li, " |
| 718 |
"\"uuid\": \"%s\" " |
| 719 |
"}", upload.lengthcxx . . $ upload_progress_node_s#length., upload.speedcxx . . $ upload_progress_node_s#speed., upload.started_atcxx . . $ upload_progress_node_s#started_at., upload.updated_atcxx . . $ upload_progress_node_s#updated_at., id); |
| 720 |
} else if (upload.receivedcxx . . $ upload_progress_node_s#received. == 0) { |
| 721 |
response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "{ \"state\" : \"starting\", \"uuid\" : \"%s\" }", id); |
| 722 |
} else { |
| 723 |
time_tcxx . . $ time_t# eta = 0, t = timecxx . . $ time(7f38134db6521d23).(NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!); |
| 724 |
if (upload.speedcxx . . $ upload_progress_node_s#speed. > 0) eta = upload.started_atcxx . . $ upload_progress_node_s#started_at. + upload.lengthcxx . . $ upload_progress_node_s#length. / upload.speedcxx . . $ upload_progress_node_s#speed.; |
| 725 |
if (eta <= t) eta = t + 1; |
| 726 |
response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "{ " |
| 727 |
"\"state\": \"uploading\", " |
| 728 |
"\"received\": %" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`! ", " |
| 729 |
"\"size\": %" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`! ", " |
| 730 |
"\"speed\": %" APR_OFF_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:567:9`! ", " |
| 731 |
"\"started_at\": %li, " |
| 732 |
"\"eta\": %li, " |
| 733 |
"\"uuid\": \"%s\" " |
| 734 |
"}", upload.receivedcxx . . $ upload_progress_node_s#received., upload.lengthcxx . . $ upload_progress_node_s#length., upload.speedcxx . . $ upload_progress_node_s#speed., upload.started_atcxx . . $ upload_progress_node_s#started_at., eta, id); |
| 735 |
} |
| 736 |
|
| 737 |
char *completed_response; |
| 738 |
|
| 739 |
/* get the jsonp callback if any */ |
| 740 |
const char *jsonp = get_json_callback_paramcxx . . $ get_json_callback_param(8126f70efb5b1ecd).(r, ¶m_error); |
| 741 |
|
| 742 |
if (param_error < 0) { |
| 743 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_INFOcxx . . $ `<external>/13723005323755402617/http_log.h:49:9`!, 0, server, |
| 744 |
"Upload Progress: Report requested with invalid JSON-P callback. uri=%s", r->uri); |
| 745 |
return HTTP_BAD_REQUESTcxx . . $ `<external>/2935095550947534277/httpd.h:512:9`!; |
| 746 |
} |
| 747 |
|
| 748 |
up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, server, |
| 749 |
"Upload Progress: JSON-P callback: %s.", jsonp); |
| 750 |
|
| 751 |
// fix up response for jsonp request, if needed |
| 752 |
if (jsonp) { |
| 753 |
completed_response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "%s(%s);\r\n", jsonp, response); |
| 754 |
} else { |
| 755 |
completed_response = apr_psprintfcxx . . $ apr_psprintf(7c29c6db901fa4cb).(r->poolcxx . . $ request_rec#pool., "%s\r\n", response); |
| 756 |
} |
| 757 |
|
| 758 |
ap_rputscxx . . $ ap_rputs(9c5b7138af70995c).(completed_response, r); |
| 759 |
|
| 760 |
return OKcxx . . $ `<external>/2935095550947534277/httpd.h:460:9`!; |
| 761 |
} |
| 762 |
|
| 763 |
static void upload_progress_child_initcxx . . $ upload_progress_child_init(3cc38af307b02f80).(apr_pool_tcxx . . $ apr_pool_t# *p, server_reccxx . . $ server_rec# *s) |
| 764 |
{ |
| 765 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, s, "upload_progress_child_init()"); |
| 766 |
|
| 767 |
apr_status_tcxx . . $ apr_status_t# rv; |
| 768 |
ServerConfigcxx . . $ ServerConfig# *config = get_server_configcxx . . $ get_server_config(87acbf1853038100).(s); |
| 769 |
|
| 770 |
if (!config->cache_lockcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_lock.) { |
| 771 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_CRITcxx . . $ `<external>/13723005323755402617/http_log.h:45:9`!, 0, s, "Global mutex not set."); |
| 772 |
return; |
| 773 |
} |
| 774 |
|
| 775 |
rv = apr_global_mutex_child_initcxx . . $ apr_global_mutex_child_init(c9a4829216c789c0).(&config->cache_lockcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_lock., config->lock_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#lock_file., p); |
| 776 |
if (rv != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 777 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_CRITcxx . . $ `<external>/13723005323755402617/http_log.h:45:9`!, rv, s, |
| 778 |
"Failed to initialise global mutex %s in child process %" |
| 779 |
APR_PID_T_FMTcxx . . $ `<external>/18006479708876329136/apr.h:570:9`! ".", config->lock_file, getpid()); |
| 780 |
} |
| 781 |
|
| 782 |
if (!config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm.) { |
| 783 |
rv = apr_shm_attachcxx . . $ apr_shm_attach(4968345ef6530d50).(&config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm., config->cache_filecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_file., p); |
| 784 |
if (rv != APR_SUCCESScxx . . $ `<external>/1863990169430021491/apr_errno.h:225:9`!) { |
| 785 |
ap_log_errorcxx . . $ `<external>/13723005323755402617/http_log.h:363:9`!(APLOG_MARKcxx . . $ `<external>/13723005323755402617/http_log.h:283:9`!, APLOG_CRITcxx . . $ `<external>/13723005323755402617/http_log.h:45:9`!, rv, s, "Failed to attach to " |
| 786 |
"shared memory file '%s'", config->cache_file); |
| 787 |
return; |
| 788 |
} |
| 789 |
} |
| 790 |
|
| 791 |
config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache. = (upload_progress_cache_tcxx . . $ upload_progress_cache_t# *)apr_shm_baseaddr_getcxx . . $ apr_shm_baseaddr_get(2c50495116e9fd92).(config->cache_shmcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache_shm.); |
| 792 |
config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list. = (int *)(config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache. + 1); |
| 793 |
config->nodescxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#nodes. = (upload_progress_node_tcxx . . $ upload_progress_node_t# *)(config->listcxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#list. + config->cachecxx . . $ $anonymous_type_8e2c9acdfaecdcde_3#cache.->countcxx . . $ $anonymous_type_8e2c9acdfaecdcde_2#count.); |
| 794 |
} |
| 795 |
|
| 796 |
static const command_reccxx . . $ command_rec# upload_progress_cmdscxx . . $ upload_progress_cmds.[] = |
| 797 |
{ |
| 798 |
AP_INIT_FLAGcxx . . $ `<external>/11954595451903284094/http_config.h:155:10`!("TrackUploads", track_upload_progress_cmd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OR_AUTHCFGcxx . . $ `<external>/11954595451903284094/http_config.h:235:9`!, |
| 799 |
"Track upload progress in this location"), |
| 800 |
AP_INIT_FLAGcxx . . $ `<external>/11954595451903284094/http_config.h:155:10`!("ReportUploads", report_upload_progress_cmd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, OR_AUTHCFGcxx . . $ `<external>/11954595451903284094/http_config.h:235:9`!, |
| 801 |
"Report upload progress in this location"), |
| 802 |
AP_INIT_TAKE1cxx . . $ `<external>/11954595451903284094/http_config.h:128:10`!("UploadProgressSharedMemorySize", upload_progress_shared_memory_size_cmd, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, RSRC_CONFcxx . . $ `<external>/11954595451903284094/http_config.h:241:9`!, |
| 803 |
"Size of shared memory used to keep uploads data, default 100KB"), |
| 804 |
{ NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! } |
| 805 |
}; |
| 806 |
|
| 807 |
static void upload_progress_register_hookscxx . . $ upload_progress_register_hooks(2920e2946854afc7). (apr_pool_tcxx . . $ apr_pool_t# *p) |
| 808 |
{ |
| 809 |
/**/up_logcxx . . $ `mod_upload_progress.c:78:11`!(APLOG_MARK, APLOG_DEBUG, 0, global_server, "upload_progress_register_hooks()"); |
| 810 |
|
| 811 |
ap_hook_fixupscxx . . $ ap_hook_fixups(6f6c147fbdb9d6e1).(upload_progress_handle_requestcxx . . $ upload_progress_handle_request(39a9a55d27f3cd8f)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, APR_HOOK_FIRSTcxx . . $ `<external>/5191369060515049401/apr_hooks.h:301:9`!); |
| 812 |
ap_hook_handlercxx . . $ ap_hook_handler(6f6c147fbdb9d6e1).(reportuploads_handlercxx . . $ reportuploads_handler(39a9a55d27f3cd8f)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, APR_HOOK_FIRSTcxx . . $ `<external>/5191369060515049401/apr_hooks.h:301:9`!); |
| 813 |
ap_hook_post_configcxx . . $ ap_hook_post_config(b0dad6cb138abd05).(upload_progress_initcxx . . $ upload_progress_init(22b9b64173c7cc4e)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, APR_HOOK_MIDDLEcxx . . $ `<external>/5191369060515049401/apr_hooks.h:303:9`!); |
| 814 |
ap_hook_child_initcxx . . $ ap_hook_child_init(b96abc8cb9b74810).(upload_progress_child_initcxx . . $ upload_progress_child_init(3cc38af307b02f80)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, APR_HOOK_MIDDLEcxx . . $ `<external>/5191369060515049401/apr_hooks.h:303:9`!); |
| 815 |
ap_register_input_filtercxx . . $ ap_register_input_filter(f75c228c44caee95).("UPLOAD_PROGRESS", track_upload_progresscxx . . $ track_upload_progress(f776fa97e01bf86a)., NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, AP_FTYPE_RESOURCEcxx . . $ AP_FTYPE_RESOURCE.); |
| 816 |
} |
| 817 |
|
| 818 |
modulecxx . . $ module# AP_MODULE_DECLARE_DATAcxx . . $ `<external>/10377806009144789469/ap_config.h:121:9`! upload_progress_modulecxx . . $ upload_progress_module. = |
| 819 |
{ |
| 820 |
STANDARD20_MODULE_STUFFcxx . . $ `<external>/11954595451903284094/http_config.h:486:9`!, |
| 821 |
upload_progress_create_dir_configcxx . . $ upload_progress_create_dir_config(ed769dc40819ee9f)., |
| 822 |
upload_progress_merge_dir_configcxx . . $ upload_progress_merge_dir_config(32947ac650ccaa82)., |
| 823 |
upload_progress_create_server_configcxx . . $ upload_progress_create_server_config(dd4397821956b594)., |
| 824 |
upload_progress_merge_server_configcxx . . $ upload_progress_merge_server_config(32947ac650ccaa82)., |
| 825 |
upload_progress_cmdscxx . . $ upload_progress_cmds., |
| 826 |
upload_progress_register_hookscxx . . $ upload_progress_register_hooks(2920e2946854afc7)., /* callback for registering hooks */ |
| 827 |
}; |