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

Function fix_hostname_non_v6

server/vhost.c:741–766  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

739}
740
741static apr_status_t fix_hostname_non_v6(request_rec *r, char *host)
742{
743 char *dst;
744
745 for (dst = host; *dst; dst++) {
746 if (apr_islower(*dst)) {
747 /* leave char unchanged */
748 }
749 else if (*dst == '.') {
750 if (*(dst + 1) == '.') {
751 return APR_EINVAL;
752 }
753 }
754 else if (apr_isupper(*dst)) {
755 *dst = apr_tolower(*dst);
756 }
757 else if (*dst == '/' || *dst == '\\') {
758 return APR_EINVAL;
759 }
760 }
761 /* strip trailing gubbins */
762 if (dst > host && dst[-1] == '.') {
763 dst[-1] = '\0';
764 }
765 return APR_SUCCESS;
766}
767
768/*
769 * If strict mode ever becomes the default, this should be folded into

Callers 1

fix_hostnameFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected