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

Function find_desc

modules/generators/mod_autoindex.c:829–869  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

827#endif
828
829static char *find_desc(autoindex_config_rec *dcfg, const char *filename_full)
830{
831 int i;
832 ai_desc_t *list = (ai_desc_t *) dcfg->desc_list->elts;
833 const char *filename_only;
834 const char *filename;
835
836 /*
837 * If the filename includes a path, extract just the name itself
838 * for the simple matches.
839 */
840 if ((filename_only = ap_strrchr_c(filename_full, '/')) == NULL) {
841 filename_only = filename_full;
842 }
843 else {
844 filename_only++;
845 }
846 for (i = 0; i < dcfg->desc_list->nelts; ++i) {
847 ai_desc_t *tuple = &list[i];
848 int found;
849
850 /*
851 * Only use the full-path filename if the pattern contains '/'s.
852 */
853 filename = (tuple->full_path) ? filename_full : filename_only;
854 /*
855 * Make the comparison using the cheapest method; only do
856 * wildcard checking if we must.
857 */
858 if (tuple->wildcards) {
859 found = (apr_fnmatch(tuple->pattern, filename, MATCH_FLAGS) == 0);
860 }
861 else {
862 found = (ap_strstr_c(filename, tuple->pattern) != NULL);
863 }
864 if (found) {
865 return tuple->description;
866 }
867 }
868 return NULL;
869}
870
871static int ignore_entry(autoindex_config_rec *d, char *path)
872{

Callers 2

make_parent_entryFunction · 0.85
make_autoindex_entryFunction · 0.85

Calls 2

ap_strrchr_cFunction · 0.85
ap_strstr_cFunction · 0.85

Tested by

no test coverage detected