Kaynağa Gözat

fix #368: coredump when set status_code=4xx and set body in async handler

ithewei 2 yıl önce
ebeveyn
işleme
950fdd2c12
1 değiştirilmiş dosya ile 6 ekleme ve 6 silme
  1. 6 6
      http/server/HttpHandler.cpp

+ 6 - 6
http/server/HttpHandler.cpp

@@ -357,12 +357,12 @@ processor:
 postprocessor:
     if (status_code >= 100 && status_code < 600) {
         pResp->status_code = (http_status)status_code;
-    }
-    if (pResp->status_code >= 400 && pResp->body.size() == 0 && pReq->method != HTTP_HEAD) {
-        if (service->errorHandler) {
-            customHttpHandler(service->errorHandler);
-        } else {
-            defaultErrorHandler();
+        if (pResp->status_code >= 400 && pResp->body.size() == 0 && pReq->method != HTTP_HEAD) {
+            if (service->errorHandler) {
+                customHttpHandler(service->errorHandler);
+            } else {
+                defaultErrorHandler();
+            }
         }
     }
     if (fc) {