headers via ctrl_socket v0.2.0
authorMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Thu, 28 Jun 2012 16:08:42 +0000 (18:08 +0200)
committerMatteo Nastasi (mop) <nastasi@alternativeoutput.com>
Thu, 28 Jun 2012 16:08:42 +0000 (18:08 +0200)
mod_proxy_fdpass.c

index ff7ddbc..691ca08 100644 (file)
@@ -283,6 +283,7 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
     char *headers_out = NULL;
     int ctrlrawsock[2];
     apr_socket_t *ctrlsock = NULL, *clientctrlsock = NULL;
+    apr_size_t wrlen;
 
     if ((headers_out = calloc(8*1024, 1)) != NULL) {
         apr_table_do(headers_builder, headers_out, r->headers_in, NULL);
@@ -375,7 +376,14 @@ static int proxy_fdpass_handler(request_rec *r, proxy_worker *worker,
                       "proxy: FD: send_socket failed:");
         return HTTP_INTERNAL_SERVER_ERROR;
     }
-
+    wrlen = strlen(headers_out);
+    rv = apr_socket_send(ctrlsock, headers_out, &wrlen);
+    if (rv != APR_SUCCESS) {
+        ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
+                      "proxy: FD: send headers failed");
+        return HTTP_INTERNAL_SERVER_ERROR;
+    }
+    apr_socket_shutdown(ctrlsock, APR_SHUTDOWN_READWRITE);
     {
         apr_socket_t *dummy;
         /* Create a dummy unconnected socket, and set it as the one we were