Browse Source

Rename md_response_header_* functions

bel2125 4 years ago
parent
commit
7b39f65b92
3 changed files with 95 additions and 95 deletions
  1. 23 23
      include/civetweb.h
  2. 63 63
      src/civetweb.c
  3. 9 9
      src/response.inl

+ 23 - 23
include/civetweb.h

@@ -1485,12 +1485,13 @@ enum { MG_TIMEOUT_INFINITE = -1 };
      On success, >= 0
      On success, >= 0
      On error/timeout, < 0
      On error/timeout, < 0
 */
 */
-CIVETWEB_API int 
-mg_get_response(struct mg_connection *conn,
-                char *ebuf,
-                size_t ebuf_len,
-                int timeout);
+CIVETWEB_API int mg_get_response(struct mg_connection *conn,
+                                 char *ebuf,
+                                 size_t ebuf_len,
+                                 int timeout);
 
 
+/* mg_response_header_* functions can be used from server callbacks,
+ */
 
 
 /* Initialize a new HTTP response
 /* Initialize a new HTTP response
  * Parameters:
  * Parameters:
@@ -1502,8 +1503,8 @@ mg_get_response(struct mg_connection *conn,
  *  -2:    invalid connection type
  *  -2:    invalid connection type
  *  -3:    invalid connection status
  *  -3:    invalid connection status
  */
  */
-CIVETWEB_API int
-mg_response_start(struct mg_connection *conn, int status);
+CIVETWEB_API int mg_response_header_start(struct mg_connection *conn,
+                                          int status);
 
 
 
 
 /* Add a new HTTP response header line
 /* Add a new HTTP response header line
@@ -1511,27 +1512,28 @@ mg_response_start(struct mg_connection *conn, int status);
  *   conn: Current connection handle.
  *   conn: Current connection handle.
  *   header: Header name.
  *   header: Header name.
  *   value: Header value.
  *   value: Header value.
- *   value_len: Length of header value, excluding the terminating zero. 
- *              Use -1 for "strlen(value)". 
- * Return:  
- *   0:    ok 
- *  -1:    parameter error 
+ *   value_len: Length of header value, excluding the terminating zero.
+ *              Use -1 for "strlen(value)".
+ * Return:
+ *   0:    ok
+ *  -1:    parameter error
  *  -2:    invalid connection type
  *  -2:    invalid connection type
  *  -3:    invalid connection status
  *  -3:    invalid connection status
  *  -4:    too many headers
  *  -4:    too many headers
  *  -5:    out of memory
  *  -5:    out of memory
  */
  */
-CIVETWEB_API int
-mg_response_add_header(struct mg_connection *conn,
-	const char *header,
-	const char *value,
-	int value_len);
+CIVETWEB_API int mg_response_header_add(struct mg_connection *conn,
+                                        const char *header,
+                                        const char *value,
+                                        int value_len);
 
 
 
 
 /* Add a complete header string (key + value).
 /* Add a complete header string (key + value).
+ * This function is less efficient as compared to mg_response_header_add,
+ * and should only be used to convert complete HTTP/1.x header lines.
  * Parameters:
  * Parameters:
  *   conn: Current connection handle.
  *   conn: Current connection handle.
- *   http1_headers: Header line(s) in the form "name: value".
+ *   http1_headers: Header line(s) in the form "name: value\r\n".
  * Return:
  * Return:
  *  >=0:   no error, number of header lines added
  *  >=0:   no error, number of header lines added
  *  -1:    parameter error
  *  -1:    parameter error
@@ -1540,9 +1542,8 @@ mg_response_add_header(struct mg_connection *conn,
  *  -4:    too many headers
  *  -4:    too many headers
  *  -5:    out of memory
  *  -5:    out of memory
  */
  */
-CIVETWEB_API int
-mg_response_add_headerlines(struct mg_connection *conn,
-	const char *http1_headers);
+CIVETWEB_API int mg_response_header_add_lines(struct mg_connection *conn,
+                                              const char *http1_headers);
 
 
 
 
 /* Send http response
 /* Send http response
@@ -1554,8 +1555,7 @@ mg_response_add_headerlines(struct mg_connection *conn,
  *  -2:    invalid connection type
  *  -2:    invalid connection type
  *  -3:    invalid connection status
  *  -3:    invalid connection status
  */
  */
-CIVETWEB_API int
-mg_response_send_headers(struct mg_connection *conn);
+CIVETWEB_API int mg_response_header_send(struct mg_connection *conn);
 
 
 
 
 /* Check which features where set when the civetweb library has been compiled.
 /* Check which features where set when the civetweb library has been compiled.

+ 63 - 63
src/civetweb.c

@@ -4586,16 +4586,16 @@ static void
 send_no_cache_header(struct mg_connection *conn)
 send_no_cache_header(struct mg_connection *conn)
 {
 {
 	/* Send all current and obsolete cache opt-out directives. */
 	/* Send all current and obsolete cache opt-out directives. */
-	mg_response_add_header(conn,
+	mg_response_header_add(conn,
 	                       "Cache-Control",
 	                       "Cache-Control",
 	                       "no-cache, no-store, "
 	                       "no-cache, no-store, "
 	                       "must-revalidate, private, max-age=0",
 	                       "must-revalidate, private, max-age=0",
 	                       -1);
 	                       -1);
-	mg_response_add_header(conn, "Expires", "0", -1);
+	mg_response_header_add(conn, "Expires", "0", -1);
 
 
 	if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 	if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 		/* Obsolete, but still send it for HTTP/1.0 */
 		/* Obsolete, but still send it for HTTP/1.0 */
-		mg_response_add_header(conn, "Pragma", "no-cache", -1);
+		mg_response_header_add(conn, "Pragma", "no-cache", -1);
 	}
 	}
 }
 }
 
 
@@ -4612,7 +4612,7 @@ send_static_cache_header(struct mg_connection *conn)
 
 
 	/* If there is a full cache-control option configured,0 use it */
 	/* If there is a full cache-control option configured,0 use it */
 	if (cache_control != NULL) {
 	if (cache_control != NULL) {
-		mg_response_add_header(conn, "Cache-Control", cache_control, -1);
+		mg_response_header_add(conn, "Cache-Control", cache_control, -1);
 		return;
 		return;
 	}
 	}
 
 
@@ -4639,7 +4639,7 @@ send_static_cache_header(struct mg_connection *conn)
 	 * as undefined. */
 	 * as undefined. */
 	mg_snprintf(
 	mg_snprintf(
 	    conn, NULL, val, sizeof(val), "max-age=%lu", (unsigned long)max_age);
 	    conn, NULL, val, sizeof(val), "max-age=%lu", (unsigned long)max_age);
-	mg_response_add_header(conn, "Cache-Control", val, -1);
+	mg_response_header_add(conn, "Cache-Control", val, -1);
 
 
 #else  /* NO_CACHING */
 #else  /* NO_CACHING */
 
 
@@ -4664,13 +4664,13 @@ send_additional_header(struct mg_connection *conn)
 			            sizeof(val),
 			            sizeof(val),
 			            "max-age=%lu",
 			            "max-age=%lu",
 			            (unsigned long)max_age);
 			            (unsigned long)max_age);
-			mg_response_add_header(conn, "Strict-Transport-Security", val, -1);
+			mg_response_header_add(conn, "Strict-Transport-Security", val, -1);
 		}
 		}
 	}
 	}
 #endif
 #endif
 
 
 	if (header && header[0]) {
 	if (header && header[0]) {
-		mg_response_add_headerlines(conn, header);
+		mg_response_header_add_lines(conn, header);
 	}
 	}
 }
 }
 
 
@@ -5040,16 +5040,16 @@ mg_send_http_error_impl(struct mg_connection *conn,
 
 
 		/* No custom error page. Send default error page. */
 		/* No custom error page. Send default error page. */
 		conn->must_close = 1;
 		conn->must_close = 1;
-		mg_response_start(conn, status);
+		mg_response_header_start(conn, status);
 		send_no_cache_header(conn);
 		send_no_cache_header(conn);
 		send_additional_header(conn);
 		send_additional_header(conn);
 		if (has_body) {
 		if (has_body) {
-			mg_response_add_header(conn,
+			mg_response_header_add(conn,
 			                       "Content-Type",
 			                       "Content-Type",
 			                       "text/plain; charset=utf-8",
 			                       "text/plain; charset=utf-8",
 			                       -1);
 			                       -1);
 		}
 		}
-		mg_response_send_headers(conn);
+		mg_response_header_send(conn);
 
 
 		/* HTTP responses 1xx, 204 and 304 MUST NOT send a body */
 		/* HTTP responses 1xx, 204 and 304 MUST NOT send a body */
 		if (has_body) {
 		if (has_body) {
@@ -5091,15 +5091,15 @@ mg_send_http_ok(struct mg_connection *conn,
 		mime_type = "text/html";
 		mime_type = "text/html";
 	}
 	}
 
 
-	mg_response_start(conn, 200);
+	mg_response_header_start(conn, 200);
 	send_no_cache_header(conn);
 	send_no_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn, "Content-Type", mime_type, -1);
+	mg_response_header_add(conn, "Content-Type", mime_type, -1);
 	if (content_length < 0) {
 	if (content_length < 0) {
 		/* Size not known. Use chunked encoding (HTTP/1.x) */
 		/* Size not known. Use chunked encoding (HTTP/1.x) */
 		if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 		if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 			/* Only HTTP/1.x defines "chunked" encoding, HTTP/2 does not*/
 			/* Only HTTP/1.x defines "chunked" encoding, HTTP/2 does not*/
-			mg_response_add_header(conn, "Transfer-Encoding", "chunked", -1);
+			mg_response_header_add(conn, "Transfer-Encoding", "chunked", -1);
 		}
 		}
 	} else {
 	} else {
 		char len[32];
 		char len[32];
@@ -5113,10 +5113,10 @@ mg_send_http_ok(struct mg_connection *conn,
 		if (!trunc) {
 		if (!trunc) {
 			/* Since 32 bytes is enough to hold any 64 bit decimal number,
 			/* Since 32 bytes is enough to hold any 64 bit decimal number,
 			 * !trunc is always true */
 			 * !trunc is always true */
-			mg_response_add_header(conn, "Content-Length", len, -1);
+			mg_response_header_add(conn, "Content-Length", len, -1);
 		}
 		}
 	}
 	}
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 
 
 	return 0;
 	return 0;
 }
 }
@@ -9103,10 +9103,10 @@ send_authorization_request(struct mg_connection *conn, const char *realm)
 	conn->must_close = 1;
 	conn->must_close = 1;
 
 
 	/* Create 401 response */
 	/* Create 401 response */
-	mg_response_start(conn, 401);
+	mg_response_header_start(conn, 401);
 	send_no_cache_header(conn);
 	send_no_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn, "Content-Length", "0", -1);
+	mg_response_header_add(conn, "Content-Length", "0", -1);
 
 
 	/* Content for "WWW-Authenticate" header */
 	/* Content for "WWW-Authenticate" header */
 	mg_snprintf(conn,
 	mg_snprintf(conn,
@@ -9120,11 +9120,11 @@ send_authorization_request(struct mg_connection *conn, const char *realm)
 
 
 	if (!trunc) {
 	if (!trunc) {
 		/* !trunc should always be true */
 		/* !trunc should always be true */
-		mg_response_add_header(conn, "WWW-Authenticate", buf, -1);
+		mg_response_header_add(conn, "WWW-Authenticate", buf, -1);
 	}
 	}
 
 
 	/* Send all headers */
 	/* Send all headers */
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 }
 }
 
 
 
 
@@ -9966,16 +9966,16 @@ handle_directory_request(struct mg_connection *conn, const char *dir)
 	conn->must_close = 1;
 	conn->must_close = 1;
 
 
 	/* Create 200 OK response */
 	/* Create 200 OK response */
-	mg_response_start(conn, 200);
+	mg_response_header_start(conn, 200);
 	send_static_cache_header(conn);
 	send_static_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn,
+	mg_response_header_add(conn,
 	                       "Content-Type",
 	                       "Content-Type",
 	                       "text/html; charset=utf-8",
 	                       "text/html; charset=utf-8",
 	                       -1);
 	                       -1);
 
 
 	/* Send all headers */
 	/* Send all headers */
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 
 
 	/* Body */
 	/* Body */
 	mg_printf(conn,
 	mg_printf(conn,
@@ -10350,18 +10350,18 @@ handle_static_file_request(struct mg_connection *conn,
 	construct_etag(etag, sizeof(etag), &filep->stat);
 	construct_etag(etag, sizeof(etag), &filep->stat);
 
 
 	/* Create 2xx (200, 206) response */
 	/* Create 2xx (200, 206) response */
-	mg_response_start(conn, conn->status_code);
+	mg_response_header_start(conn, conn->status_code);
 	send_static_cache_header(conn);
 	send_static_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn,
+	mg_response_header_add(conn,
 	                       "Content-Type",
 	                       "Content-Type",
 	                       mime_vec.ptr,
 	                       mime_vec.ptr,
 	                       (int)mime_vec.len);
 	                       (int)mime_vec.len);
 	if (cors1[0] != 0) {
 	if (cors1[0] != 0) {
-		mg_response_add_header(conn, cors1, cors2, -1);
+		mg_response_header_add(conn, cors1, cors2, -1);
 	}
 	}
-	mg_response_add_header(conn, "Last-Modified", lm, -1);
-	mg_response_add_header(conn, "Etag", etag, -1);
+	mg_response_header_add(conn, "Last-Modified", lm, -1);
+	mg_response_header_add(conn, "Etag", etag, -1);
 
 
 #if defined(USE_ZLIB)
 #if defined(USE_ZLIB)
 	/* On the fly compression allowed */
 	/* On the fly compression allowed */
@@ -10371,7 +10371,7 @@ handle_static_file_request(struct mg_connection *conn,
 		encoding = "gzip";
 		encoding = "gzip";
 		if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 		if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 			/* HTTP/2 is always using "chunks" (frames) */
 			/* HTTP/2 is always using "chunks" (frames) */
-			mg_response_add_header(conn, "Transfer-Encoding", "chunked", -1);
+			mg_response_header_add(conn, "Transfer-Encoding", "chunked", -1);
 		}
 		}
 
 
 	} else
 	} else
@@ -10385,27 +10385,27 @@ handle_static_file_request(struct mg_connection *conn,
 		mg_snprintf(conn, &trunc, len, sizeof(len), "%" INT64_FMT, cl);
 		mg_snprintf(conn, &trunc, len, sizeof(len), "%" INT64_FMT, cl);
 
 
 		if (!trunc) {
 		if (!trunc) {
-			mg_response_add_header(conn, "Content-Length", len, -1);
+			mg_response_header_add(conn, "Content-Length", len, -1);
 		}
 		}
 
 
-		mg_response_add_header(conn, "Accept-Ranges", "bytes", -1);
+		mg_response_header_add(conn, "Accept-Ranges", "bytes", -1);
 	}
 	}
 
 
 	if (encoding) {
 	if (encoding) {
-		mg_response_add_header(conn, "Content-Encoding", encoding, -1);
+		mg_response_header_add(conn, "Content-Encoding", encoding, -1);
 	}
 	}
 	if (range[0] != 0) {
 	if (range[0] != 0) {
-		mg_response_add_header(conn, "Content-Range", range, -1);
+		mg_response_header_add(conn, "Content-Range", range, -1);
 	}
 	}
 
 
 	/* The code above does not add any header starting with X- to make
 	/* The code above does not add any header starting with X- to make
 	 * sure no one of the additional_headers is included twice */
 	 * sure no one of the additional_headers is included twice */
 	if ((additional_headers != NULL) && (*additional_headers != 0)) {
 	if ((additional_headers != NULL) && (*additional_headers != 0)) {
-		mg_response_add_headerlines(conn, additional_headers);
+		mg_response_header_add_lines(conn, additional_headers);
 	}
 	}
 
 
 	/* Send all headers */
 	/* Send all headers */
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 
 
 	if (!is_head_request) {
 	if (!is_head_request) {
 #if defined(USE_ZLIB)
 #if defined(USE_ZLIB)
@@ -10469,14 +10469,14 @@ handle_not_modified_static_file_request(struct mg_connection *conn,
 	construct_etag(etag, sizeof(etag), &filep->stat);
 	construct_etag(etag, sizeof(etag), &filep->stat);
 
 
 	/* Create 304 "not modified" response */
 	/* Create 304 "not modified" response */
-	mg_response_start(conn, 304);
+	mg_response_header_start(conn, 304);
 	send_static_cache_header(conn);
 	send_static_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn, "Last-Modified", lm, -1);
-	mg_response_add_header(conn, "Etag", etag, -1);
+	mg_response_header_add(conn, "Last-Modified", lm, -1);
+	mg_response_header_add(conn, "Etag", etag, -1);
 
 
 	/* Send all headers */
 	/* Send all headers */
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 }
 }
 #endif
 #endif
 
 
@@ -11901,13 +11901,13 @@ mkcol(struct mg_connection *conn, const char *path)
 	if (rc == 0) {
 	if (rc == 0) {
 
 
 		/* Create 201 "Created" response */
 		/* Create 201 "Created" response */
-		mg_response_start(conn, 201);
+		mg_response_header_start(conn, 201);
 		send_static_cache_header(conn);
 		send_static_cache_header(conn);
 		send_additional_header(conn);
 		send_additional_header(conn);
-		mg_response_add_header(conn, "Content-Length", "0", -1);
+		mg_response_header_add(conn, "Content-Length", "0", -1);
 
 
 		/* Send all headers - there is no body */
 		/* Send all headers - there is no body */
-		mg_response_send_headers(conn);
+		mg_response_header_send(conn);
 
 
 	} else {
 	} else {
 		if (errno == EEXIST) {
 		if (errno == EEXIST) {
@@ -11975,13 +11975,13 @@ put_file(struct mg_connection *conn, const char *path)
 		/* put_dir returns 0 if path is a directory */
 		/* put_dir returns 0 if path is a directory */
 
 
 		/* Create response */
 		/* Create response */
-		mg_response_start(conn, conn->status_code);
+		mg_response_header_start(conn, conn->status_code);
 		send_no_cache_header(conn);
 		send_no_cache_header(conn);
 		send_additional_header(conn);
 		send_additional_header(conn);
-		mg_response_add_header(conn, "Content-Length", "0", -1);
+		mg_response_header_add(conn, "Content-Length", "0", -1);
 
 
 		/* Send all headers - there is no body */
 		/* Send all headers - there is no body */
-		mg_response_send_headers(conn);
+		mg_response_header_send(conn);
 
 
 		/* Request to create a directory has been fulfilled successfully.
 		/* Request to create a directory has been fulfilled successfully.
 		 * No need to put a file. */
 		 * No need to put a file. */
@@ -12044,13 +12044,13 @@ put_file(struct mg_connection *conn, const char *path)
 	}
 	}
 
 
 	/* Create response (status_code has been set before) */
 	/* Create response (status_code has been set before) */
-	mg_response_start(conn, conn->status_code);
+	mg_response_header_start(conn, conn->status_code);
 	send_no_cache_header(conn);
 	send_no_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn, "Content-Length", "0", -1);
+	mg_response_header_add(conn, "Content-Length", "0", -1);
 
 
 	/* Send all headers - there is no body */
 	/* Send all headers - there is no body */
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 }
 }
 
 
 
 
@@ -12094,11 +12094,11 @@ delete_file(struct mg_connection *conn, const char *path)
 	/* Try to delete it. */
 	/* Try to delete it. */
 	if (mg_remove(conn, path) == 0) {
 	if (mg_remove(conn, path) == 0) {
 		/* Delete was successful: Return 204 without content. */
 		/* Delete was successful: Return 204 without content. */
-		mg_response_start(conn, 204);
+		mg_response_header_start(conn, 204);
 		send_no_cache_header(conn);
 		send_no_cache_header(conn);
 		send_additional_header(conn);
 		send_additional_header(conn);
-		mg_response_add_header(conn, "Content-Length", "0", -1);
-		mg_response_send_headers(conn);
+		mg_response_header_add(conn, "Content-Length", "0", -1);
+		mg_response_header_send(conn);
 
 
 	} else {
 	} else {
 		/* Delete not successful (file locked). */
 		/* Delete not successful (file locked). */
@@ -12386,14 +12386,14 @@ handle_ssi_file_request(struct mg_connection *conn,
 		fclose_on_exec(&filep->access, conn);
 		fclose_on_exec(&filep->access, conn);
 
 
 		/* 200 OK response */
 		/* 200 OK response */
-		mg_response_start(conn, 200);
+		mg_response_header_start(conn, 200);
 		send_no_cache_header(conn);
 		send_no_cache_header(conn);
 		send_additional_header(conn);
 		send_additional_header(conn);
-		mg_response_add_header(conn, "Content-Type", "text/html", -1);
+		mg_response_header_add(conn, "Content-Type", "text/html", -1);
 		if (cors1[0]) {
 		if (cors1[0]) {
-			mg_response_add_header(conn, cors1, cors2, -1);
+			mg_response_header_add(conn, cors1, cors2, -1);
 		}
 		}
-		mg_response_send_headers(conn);
+		mg_response_header_send(conn);
 
 
 		/* Header sent, now send body */
 		/* Header sent, now send body */
 		send_ssi_file(conn, path, filep, 0);
 		send_ssi_file(conn, path, filep, 0);
@@ -12415,22 +12415,22 @@ send_options(struct mg_connection *conn)
 	 * Since browsers do not send an OPTIONS request, we can not test the
 	 * Since browsers do not send an OPTIONS request, we can not test the
 	 * effect anyway. */
 	 * effect anyway. */
 
 
-	mg_response_start(conn, 200);
-	mg_response_add_header(conn, "Content-Type", "text/html", -1);
+	mg_response_header_start(conn, 200);
+	mg_response_header_add(conn, "Content-Type", "text/html", -1);
 	if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 	if (conn->protocol_type == PROTOCOL_TYPE_HTTP1) {
 		/* Use the same as before */
 		/* Use the same as before */
-		mg_response_add_header(
+		mg_response_header_add(
 		    conn,
 		    conn,
 		    "Allow",
 		    "Allow",
 		    "GET, POST, HEAD, CONNECT, PUT, DELETE, OPTIONS, PROPFIND, MKCOL",
 		    "GET, POST, HEAD, CONNECT, PUT, DELETE, OPTIONS, PROPFIND, MKCOL",
 		    -1);
 		    -1);
-		mg_response_add_header(conn, "DAV", "1", -1);
+		mg_response_header_add(conn, "DAV", "1", -1);
 	} else {
 	} else {
 		/* TODO: Check this later for HTTP/2 */
 		/* TODO: Check this later for HTTP/2 */
-		mg_response_add_header(conn, "Allow", "GET, POST", -1);
+		mg_response_header_add(conn, "Allow", "GET, POST", -1);
 	}
 	}
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_send_headers(conn);
+	mg_response_header_send(conn);
 }
 }
 
 
 
 
@@ -12524,11 +12524,11 @@ handle_propfind(struct mg_connection *conn,
 	conn->must_close = 1;
 	conn->must_close = 1;
 
 
 	/* return 207 "Multi-Status" */
 	/* return 207 "Multi-Status" */
-	mg_response_start(conn, 207);
+	mg_response_header_start(conn, 207);
 	send_static_cache_header(conn);
 	send_static_cache_header(conn);
 	send_additional_header(conn);
 	send_additional_header(conn);
-	mg_response_add_header(conn, "Content-Type", "text/xml; charset=utf-8", -1);
-	mg_response_send_headers(conn);
+	mg_response_header_add(conn, "Content-Type", "text/xml; charset=utf-8", -1);
+	mg_response_header_send(conn);
 
 
 	/* Content */
 	/* Content */
 	mg_printf(conn,
 	mg_printf(conn,

+ 9 - 9
src/response.inl

@@ -39,7 +39,7 @@ free_buffered_response_header_list(struct mg_connection *conn)
  *  -3:    invalid connection status
  *  -3:    invalid connection status
  */
  */
 int
 int
-mg_response_start(struct mg_connection *conn, int status)
+mg_response_header_start(struct mg_connection *conn, int status)
 {
 {
 	if ((conn == NULL) || (status < 100) || (status > 999)) {
 	if ((conn == NULL) || (status < 100) || (status > 999)) {
 		/* Parameter error */
 		/* Parameter error */
@@ -73,7 +73,7 @@ mg_response_start(struct mg_connection *conn, int status)
  * out of memory
  * out of memory
  */
  */
 int
 int
-mg_response_add_header(struct mg_connection *conn,
+mg_response_header_add(struct mg_connection *conn,
                        const char *header,
                        const char *header,
                        const char *value,
                        const char *value,
                        int value_len)
                        int value_len)
@@ -90,7 +90,7 @@ mg_response_add_header(struct mg_connection *conn,
 		return -2;
 		return -2;
 	}
 	}
 	if (conn->request_state != 1) {
 	if (conn->request_state != 1) {
-		/* only allowed if mg_response_start was called */
+		/* only allowed if mg_response_header_start has been called before */
 		return -3;
 		return -3;
 	}
 	}
 
 
@@ -148,8 +148,8 @@ static int parse_http_headers(char **buf, struct mg_header hdr[MG_MAX_HEADERS]);
  *  -5:    out of memory
  *  -5:    out of memory
  */
  */
 int
 int
-mg_response_add_headerlines(struct mg_connection *conn,
-                            const char *http1_headers)
+mg_response_header_add_lines(struct mg_connection *conn,
+                             const char *http1_headers)
 {
 {
 	struct mg_header add_hdr[MG_MAX_HEADERS];
 	struct mg_header add_hdr[MG_MAX_HEADERS];
 	int num_hdr, i, ret;
 	int num_hdr, i, ret;
@@ -170,14 +170,14 @@ mg_response_add_headerlines(struct mg_connection *conn,
 
 
 	for (i = 0; i < num_hdr; i++) {
 	for (i = 0; i < num_hdr; i++) {
 		int lret =
 		int lret =
-		    mg_response_add_header(conn, add_hdr[i].name, add_hdr[i].value, -1);
+		    mg_response_header_add(conn, add_hdr[i].name, add_hdr[i].value, -1);
 		if ((ret > 0) && (lret < 0)) {
 		if ((ret > 0) && (lret < 0)) {
 			/* Store error return value */
 			/* Store error return value */
 			ret = lret;
 			ret = lret;
 		}
 		}
 	}
 	}
 
 
-	/* mg_response_add_header created a copy, so we can free the original */
+	/* mg_response_header_add created a copy, so we can free the original */
 	mg_free(workbuffer);
 	mg_free(workbuffer);
 	return ret;
 	return ret;
 }
 }
@@ -198,7 +198,7 @@ static int http2_send_response_headers(struct mg_connection *conn);
  *  -3:    invalid connection status
  *  -3:    invalid connection status
  */
  */
 int
 int
-mg_response_send_headers(struct mg_connection *conn)
+mg_response_header_send(struct mg_connection *conn)
 {
 {
 	const char *txt;
 	const char *txt;
 	int i;
 	int i;
@@ -215,7 +215,7 @@ mg_response_send_headers(struct mg_connection *conn)
 		return -2;
 		return -2;
 	}
 	}
 	if (conn->request_state != 1) {
 	if (conn->request_state != 1) {
-		/* only allowed if mg_response_start was called */
+		/* only allowed if mg_response_header_start has been called before */
 		return -3;
 		return -3;
 	}
 	}