Browse Source

Revert "Revert "Поддержать метод OPTIONS во внешнем uaas""

conterouz 1 year ago
parent
commit
b698318450
2 changed files with 12 additions and 3 deletions
  1. 8 3
      library/cpp/http/server/http_ex.cpp
  2. 4 0
      library/cpp/http/server/http_ex.h

+ 8 - 3
library/cpp/http/server/http_ex.cpp

@@ -103,9 +103,14 @@ bool THttpClientRequestExtension::ProcessHeaders(TBaseServerRequestData& rd, TBl
             break;
 
         case Options:
-            Output() << "HTTP/1.1 405 Method Not Allowed\r\n\r\n";
-            return false;
-            
+            if (!OptionsAllowed()) {
+                Output() << "HTTP/1.1 405 Method Not Allowed\r\n\r\n";
+                return false;
+            } else if (!Parse(urlStart, rd)) {
+                return false;
+            }
+            break;
+
         case NotImplemented:
             Output() << "HTTP/1.1 501 Not Implemented\r\n\r\n";
             return false;

+ 4 - 0
library/cpp/http/server/http_ex.h

@@ -8,6 +8,10 @@ class THttpClientRequestExtension: public TClientRequest {
 public:
     bool Parse(char* req, TBaseServerRequestData& rd);
     bool ProcessHeaders(TBaseServerRequestData& rd, TBlob& postData);
+protected:
+    virtual bool OptionsAllowed() {
+        return false;
+    }
 };
 
 template <class TRequestData>