MCPcopy Create free account
hub / github.com/apache/httpd / ap_os_escape_path

Function ap_os_escape_path

server/util.c:2073–2100  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2071}
2072
2073AP_DECLARE(char *) ap_os_escape_path(apr_pool_t *p, const char *path, int partial)
2074{
2075 char *copy = apr_palloc(p, 3 * strlen(path) + 3);
2076 const unsigned char *s = (const unsigned char *)path;
2077 unsigned char *d = (unsigned char *)copy;
2078 unsigned c;
2079
2080 if (!partial) {
2081 const char *colon = ap_strchr_c(path, ':');
2082 const char *slash = ap_strchr_c(path, '/');
2083
2084 if (colon && (!slash || colon < slash)) {
2085 *d++ = '.';
2086 *d++ = '/';
2087 }
2088 }
2089 while ((c = *s)) {
2090 if (TEST_CHAR(c, T_OS_ESCAPE_PATH)) {
2091 d = c2x(c, '%', d);
2092 }
2093 else {
2094 *d++ = c;
2095 }
2096 ++s;
2097 }
2098 *d = '\0';
2099 return copy;
2100}
2101
2102AP_DECLARE(char *) ap_escape_urlencoded_buffer(char *copy, const char *buffer)
2103{

Callers 4

proxy_send_dir_filterFunction · 0.85
try_alias_listFunction · 0.85
output_directoriesFunction · 0.85
lua_ap_os_escape_pathFunction · 0.85

Calls 2

ap_strchr_cFunction · 0.85
c2xFunction · 0.70

Tested by

no test coverage detected