ithewei 3 سال پیش
والد
کامیت
3b8cde1210
2فایلهای تغییر یافته به همراه6 افزوده شده و 2 حذف شده
  1. 5 1
      http/HttpMessage.h
  2. 1 1
      http/WebSocketChannel.h

+ 5 - 1
http/HttpMessage.h

@@ -211,7 +211,11 @@ public:
             ParseBody();
             if (form.empty()) return HTTP_STATUS_BAD_REQUEST;
         }
-        const hv::FormData& formdata = form[name];
+        auto iter = form.find(name);
+        if (iter == form.end()) {
+            return HTTP_STATUS_BAD_REQUEST;
+        }
+        const auto& formdata = iter->second;
         if (formdata.content.empty()) {
             return HTTP_STATUS_BAD_REQUEST;
         }

+ 1 - 1
http/WebSocketChannel.h

@@ -92,7 +92,7 @@ protected:
             has_mask = true;
         }
         int frame_size = ws_calc_frame_size(len, has_mask);
-        if (sendbuf_.len < frame_size) {
+        if (sendbuf_.len < (size_t)frame_size) {
             sendbuf_.resize(ceil2e(frame_size));
         }
         ws_build_frame(sendbuf_.base, buf, len, mask, has_mask, opcode, fin);