1
0
mirror of https://github.com/apache/httpd.git synced 2025-08-08 15:02:10 +03:00

More prototypical API support for arbitrary extension HTTP methods.

git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@86054 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ken Coar
2000-08-11 23:45:57 +00:00
parent db1852bded
commit 001a3da2cd
2 changed files with 36 additions and 0 deletions

View File

@@ -470,6 +470,15 @@ CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri);
*/ */
API_EXPORT(int) ap_method_number_of(const char *method); API_EXPORT(int) ap_method_number_of(const char *method);
/**
* Get the method name associated with the given internal method
* number. Returns NULL if not recognized.
* @param methnum An integer value corresponding to an internal method number
* @return The name corresponding to the method number
* @deffunc const char *ap_method_name_of(int methnum)
*/
API_EXPORT(const char *) ap_method_name_of(int methnum);
/* Hooks */ /* Hooks */
/* /*
* post_read_request --- run right after read_request or internal_redirect, * post_read_request --- run right after read_request or internal_redirect,

View File

@@ -809,6 +809,33 @@ API_EXPORT(int) ap_method_number_of(const char *method)
return M_INVALID; return M_INVALID;
} }
API_EXPORT(const char *) ap_method_name_of(int methnum) {
static const char *AP_HTTP_METHODS[] = {
[M_GET] = "GET",
[M_PUT] = "PUT",
[M_POST] = "POST",
[M_DELETE] = "DELETE",
[M_CONNECT] = "CONNECT",
[M_OPTIONS] = "OPTIONS",
[M_TRACE] = "TRACE",
[M_PATCH] = "PATCH",
[M_PROPFIND] = "PROPFIND",
[M_PROPPATCH] = "PROPPATCH",
[M_MKCOL] = "MKCOL",
[M_COPY] = "COPY",
[M_MOVE] = "MOVE",
[M_LOCK] = "LOCK",
[M_UNLOCK] = "UNLOCK",
[M_INVALID] = NULL
};
if ((methnum == M_INVALID) || (methnum >= METHODS)) {
return NULL;
}
return AP_HTTP_METHODS[methnum];
}
/* Get a line of protocol input, including any continuation lines /* Get a line of protocol input, including any continuation lines
* caused by MIME folding (or broken clients) if fold != 0, and place it * caused by MIME folding (or broken clients) if fold != 0, and place it
* in the buffer s, of size n bytes, without the ending newline. * in the buffer s, of size n bytes, without the ending newline.