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

Function get_canned_error_string

modules/http/http_protocol.c:1136–1368  ·  view source on GitHub ↗

construct and return the default error message for a given * HTTP defined error code */

Source from the content-addressed store, hash-verified

1134 * HTTP defined error code
1135 */
1136static const char *get_canned_error_string(int status,
1137 request_rec *r,
1138 const char *location)
1139{
1140 apr_pool_t *p = r->pool;
1141 const char *error_notes, *h1, *s1;
1142
1143 switch (status) {
1144 case HTTP_MOVED_PERMANENTLY:
1145 case HTTP_MOVED_TEMPORARILY:
1146 case HTTP_TEMPORARY_REDIRECT:
1147 case HTTP_PERMANENT_REDIRECT:
1148 return(apr_pstrcat(p,
1149 "<p>The document has moved <a href=\"",
1150 ap_escape_html(r->pool, location),
1151 "\">here</a>.</p>\n",
1152 NULL));
1153 case HTTP_SEE_OTHER:
1154 return(apr_pstrcat(p,
1155 "<p>The answer to your request is located "
1156 "<a href=\"",
1157 ap_escape_html(r->pool, location),
1158 "\">here</a>.</p>\n",
1159 NULL));
1160 case HTTP_USE_PROXY:
1161 return("<p>This resource is only accessible "
1162 "through the proxy\n"
1163 "<br />\nYou will need to configure "
1164 "your client to use that proxy.</p>\n");
1165 case HTTP_PROXY_AUTHENTICATION_REQUIRED:
1166 case HTTP_UNAUTHORIZED:
1167 return("<p>This server could not verify that you\n"
1168 "are authorized to access the document\n"
1169 "requested. Either you supplied the wrong\n"
1170 "credentials (e.g., bad password), or your\n"
1171 "browser doesn't understand how to supply\n"
1172 "the credentials required.</p>\n");
1173 case HTTP_BAD_REQUEST:
1174 return(add_optional_notes(r,
1175 "<p>Your browser sent a request that "
1176 "this server could not understand.<br />\n",
1177 "error-notes",
1178 "</p>\n"));
1179 case HTTP_FORBIDDEN:
1180 return(add_optional_notes(r, "<p>You don't have permission to access this resource.", "error-notes", "</p>\n"));
1181 case HTTP_NOT_FOUND:
1182 return("<p>The requested URL was not found on this server.</p>\n");
1183 case HTTP_METHOD_NOT_ALLOWED:
1184 return(apr_pstrcat(p,
1185 "<p>The requested method ",
1186 ap_escape_html(r->pool, r->method),
1187 " is not allowed for this URL.</p>\n",
1188 NULL));
1189 case HTTP_NOT_ACCEPTABLE:
1190 return(add_optional_notes(r,
1191 "<p>An appropriate representation of the requested resource "
1192 "could not be found on this server.</p>\n",
1193 "variant-list", ""));

Callers 1

ap_send_error_responseFunction · 0.85

Calls 1

add_optional_notesFunction · 0.85

Tested by

no test coverage detected