From 6be11c1a16625c7cd62aa5d0d9144751af815a29 Mon Sep 17 00:00:00 2001
From: Sonny Karlsson <ksonny@lotrax.org>
Date: Tue, 17 Jul 2012 21:29:48 +0200
Subject: [PATCH] http: Check if plugin set status in http_init.

Checks if header status is set when MK_PLUGIN_RET_CLOSE_CONX is
returned in stage_30 and uses it instead of MK_CLIENT_FORBIDDEN.

Signed-off-by: Sonny Karlsson <ksonny@lotrax.org>
---
 src/mk_http.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mk_http.c b/src/mk_http.c
index 3a7026c..018eed5 100644
--- a/src/mk_http.c
+++ b/src/mk_http.c
@@ -198,7 +198,12 @@ int mk_http_init(struct client_session *cs, struct session_request *sr)
         MK_TRACE("No file, look for handler plugin");
         ret = mk_plugin_stage_run(MK_PLUGIN_STAGE_30, cs->socket, NULL, cs, sr);
         if (ret == MK_PLUGIN_RET_CLOSE_CONX) {
-            return mk_request_error(MK_CLIENT_FORBIDDEN, cs, sr);
+            if (sr->headers.status > 0) {
+                return mk_request_error(sr->headers.status, cs, sr);
+            }
+            else {
+                return mk_request_error(MK_CLIENT_FORBIDDEN, cs, sr);
+            }
         }
         else if (ret == MK_PLUGIN_RET_CONTINUE) {
             return MK_PLUGIN_RET_CONTINUE;
-- 
1.7.10.4

