summaryrefslogtreecommitdiff
path: root/network_io
diff options
context:
space:
mode:
authortrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2000-07-18 15:16:46 +0000
committertrawick <trawick@13f79535-47bb-0310-9956-ffa450edef68>2000-07-18 15:16:46 +0000
commit486ecfb468ad6d4ffd4144d569e282d1c054c5a9 (patch)
tree21629f36a7e816f6232bd19a533bf340361f17ee /network_io
parent381e863ce3881dd3a64f1b0ceb6a02878e73db47 (diff)
downloadlibapr-486ecfb468ad6d4ffd4144d569e282d1c054c5a9.tar.gz
ap_sendfile() fix: If the caller passes NULL for the ap_hdtr_t *,
set hdtr to the address of one that specifies no headers and trailers. This prevents accessing low core while keeping the following code simpler (no need to check hdtr != NULL later). git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60390 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'network_io')
-rw-r--r--network_io/unix/sendrecv.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/network_io/unix/sendrecv.c b/network_io/unix/sendrecv.c
index 16c635bb0..9ebb612d9 100644
--- a/network_io/unix/sendrecv.c
+++ b/network_io/unix/sendrecv.c
@@ -211,6 +211,8 @@ ap_status_t ap_sendv(ap_socket_t * sock, const struct iovec *vec,
* - Should flags be an int_32 or what?
*/
+static ap_hdtr_t no_hdtr; /* used below when caller passes NULL for ap_hdtr_t */
+
#if defined(__linux__) && defined(HAVE_WRITEV)
/* TCP_CORK keeps us from sending partial frames when we shouldn't
@@ -266,6 +268,10 @@ ap_status_t ap_sendfile(ap_socket_t *sock, ap_file_t *file,
int rv, nbytes = 0, total_hdrbytes, i, delayflag = APR_EINIT, corked = 0;
ap_status_t arv;
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+ }
+
/* Ignore flags for now. */
flags = 0;
@@ -394,6 +400,10 @@ ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file,
struct sf_hdtr headerstruct;
size_t bytes_to_send = *len;
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+ }
+
/* Ignore flags for now. */
flags = 0;
@@ -484,6 +494,10 @@ ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file,
struct iovec hdtrarray[2];
void *headerbuf, *trailerbuf;
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+ }
+
/* Ignore flags for now. */
flags = 0;
@@ -586,6 +600,10 @@ ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file,
ap_status_t arv;
struct sf_parms parms;
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+ }
+
/* Ignore flags for now. */
flags = 0;
@@ -712,6 +730,10 @@ ap_status_t ap_sendfile(ap_socket_t * sock, ap_file_t * file,
struct iovec headerstruct[2] = {(0, 0), (0, 0)};
size_t bytes_to_send = *len;
+ if (!hdtr) {
+ hdtr = &no_hdtr;
+ }
+
/* Ignore flags for now. */
flags = 0;