소스 검색

Improved OPTIONS method.

default 10 달 전
부모
커밋
66642bcbcc
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      httpd.c

+ 3 - 0
httpd.c

@@ -373,6 +373,9 @@ void httpd_connection(FILE *f)
     }
     else
     if (strcmp(method, "OPTIONS") == 0) {
+        const char *methods = "OPTIONS, GET, HEAD, POST, PUT, DELETE";
+        headers = xs_dict_append(headers, "allow", methods);
+        headers = xs_dict_append(headers, "access-control-allow-methods", methods);
         status = HTTP_STATUS_OK;
     }
     else