From: Graham Leggett Date: Sat, 6 Apr 2002 14:31:05 +0000 (+0000) Subject: Namespace protect getline() and get_chunk_size(). X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c2adb842ef30ed5b866b3b44f1f0fa855bd49e4b;p=thirdparty%2Fapache%2Fhttpd.git Namespace protect getline() and get_chunk_size(). Export ap_getline() and ap_get_chunk_size(). PR: Obtained from: Submitted by: Reviewed by: git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/1.3.x@94506 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/include/ap_mmn.h b/src/include/ap_mmn.h index f587f81699c..07a2818664f 100644 --- a/src/include/ap_mmn.h +++ b/src/include/ap_mmn.h @@ -235,6 +235,7 @@ * filter_callback to the end of buff.h * 19990320.11 - Add some fields to the end of the core_dir_config * structure + * 19990320.12 - add ap_getline(), ap_get_chunk_size() */ #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */ @@ -242,7 +243,7 @@ #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320 #endif -#define MODULE_MAGIC_NUMBER_MINOR 11 /* 0...n */ +#define MODULE_MAGIC_NUMBER_MINOR 12 /* 0...n */ /* Useful for testing for features. */ #define AP_MODULE_MAGIC_AT_LEAST(major,minor) \ diff --git a/src/main/http_protocol.c b/src/main/http_protocol.c index 0373a490c1f..64ab0f970db 100644 --- a/src/main/http_protocol.c +++ b/src/main/http_protocol.c @@ -857,13 +857,13 @@ API_EXPORT(int) ap_method_number_of(const char *method) * then the actual input line exceeded the buffer length, * and it would be a good idea for the caller to puke 400 or 414. */ -static int getline(char *s, int n, BUFF *in, int fold) +API_EXPORT(int) ap_getline(char *s, int n, BUFF *in, int fold) { char *pos, next; int retval; int total = 0; #ifdef CHARSET_EBCDIC - /* When getline() is called, the HTTP protocol is in a state + /* When ap_getline() is called, the HTTP protocol is in a state * where we MUST be reading "plain text" protocol stuff, * (Request line, MIME headers, Chunk sizes) regardless of * the MIME type and conversion setting of the document itself. @@ -978,7 +978,7 @@ CORE_EXPORT(void) ap_parse_uri(request_rec *r, const char *uri) static int read_request_line(request_rec *r) { - char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* getline's two extra for \n\0 */ + char l[DEFAULT_LIMIT_REQUEST_LINE + 2]; /* ap_getline's two extra for \n\0 */ const char *ll = l; const char *uri; conn_rec *conn = r->connection; @@ -1000,7 +1000,7 @@ static int read_request_line(request_rec *r) * have to block during a read. */ ap_bsetflag(conn->client, B_SAFEREAD, 1); - while ((len = getline(l, sizeof(l), conn->client, 0)) <= 0) { + while ((len = ap_getline(l, sizeof(l), conn->client, 0)) <= 0) { if ((len < 0) || ap_bgetflag(conn->client, B_EOF)) { ap_bsetflag(conn->client, B_SAFEREAD, 0); /* this is a hack to make sure that request time is set, @@ -1031,7 +1031,7 @@ static int read_request_line(request_rec *r) ap_parse_uri(r, uri); - /* getline returns (size of max buffer - 1) if it fills up the + /* ap_getline returns (size of max buffer - 1) if it fills up the * buffer before finding the end-of-line. This is only going to * happen if it exceeds the configured limit for a request-line. */ @@ -1056,7 +1056,7 @@ static int read_request_line(request_rec *r) static void get_mime_headers(request_rec *r) { - char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* getline's two extra */ + char field[DEFAULT_LIMIT_REQUEST_FIELDSIZE + 2]; /* ap_getline's two extra */ conn_rec *c = r->connection; char *value; char *copy; @@ -1071,7 +1071,7 @@ static void get_mime_headers(request_rec *r) * Read header lines until we get the empty separator line, a read error, * the connection closes (EOF), reach the server limit, or we timeout. */ - while ((len = getline(field, sizeof(field), c->client, 1)) > 0) { + while ((len = ap_getline(field, sizeof(field), c->client, 1)) > 0) { if (r->server->limit_req_fields && (++fields_read > r->server->limit_req_fields)) { @@ -1081,7 +1081,7 @@ static void get_mime_headers(request_rec *r) "this server's limit.

\n"); return; } - /* getline returns (size of max buffer - 1) if it fills up the + /* ap_getline returns (size of max buffer - 1) if it fills up the * buffer before finding the end-of-line. This is only going to * happen if it exceeds the configured limit for a field size. */ @@ -2018,7 +2018,7 @@ API_EXPORT(int) ap_should_client_block(request_rec *r) return 1; } -static long get_chunk_size(char *b) +API_EXPORT(long) ap_get_chunk_size(char *b) { long chunksize = 0; @@ -2100,14 +2100,14 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) if (r->remaining == 0) { /* Start of new chunk */ - chunk_start = getline(buffer, bufsiz, r->connection->client, 0); + chunk_start = ap_getline(buffer, bufsiz, r->connection->client, 0); if ((chunk_start <= 0) || (chunk_start >= (bufsiz - 1)) || !ap_isxdigit(*buffer)) { r->connection->keepalive = -1; return -1; } - len_to_read = get_chunk_size(buffer); + len_to_read = ap_get_chunk_size(buffer); if (len_to_read == 0) { /* Last chunk indicated, get footers */ if (r->read_body == REQUEST_CHUNKED_DECHUNK) { @@ -2141,7 +2141,7 @@ API_EXPORT(long) ap_get_client_block(request_rec *r, char *buffer, int bufsiz) len_read = chunk_start; while ((bufsiz > 1) && ((len_read = - getline(buffer, bufsiz, r->connection->client, 1)) > 0)) { + ap_getline(buffer, bufsiz, r->connection->client, 1)) > 0)) { if (len_read != (bufsiz - 1)) { buffer[len_read++] = CR; /* Restore footer line end */ diff --git a/src/support/httpd.exp b/src/support/httpd.exp index 208689b9515..c2ae5a76ac6 100644 --- a/src/support/httpd.exp +++ b/src/support/httpd.exp @@ -129,6 +129,7 @@ ap_fini_vhost_config ap_fnmatch ap_force_library_loading ap_get_basic_auth_pw +ap_get_chunk_size ap_get_client_block ap_get_gmtoff ap_get_list_item @@ -142,6 +143,7 @@ ap_get_server_version ap_get_time ap_get_token ap_get_virthost_addr +ap_getline ap_getparents ap_getword ap_getword_conf