diff options
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r-- | src/microhttpd/internal.h | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h index 346001c3..e684aa88 100644 --- a/src/microhttpd/internal.h +++ b/src/microhttpd/internal.h | |||
@@ -732,6 +732,59 @@ enum MHD_ConnKeepAlive | |||
732 | MHD_CONN_USE_KEEPALIVE = 1 | 732 | MHD_CONN_USE_KEEPALIVE = 1 |
733 | }; | 733 | }; |
734 | 734 | ||
735 | enum MHD_HTTP_version | ||
736 | { | ||
737 | /** | ||
738 | * Not a HTTP protocol or HTTP version is invalid. | ||
739 | */ | ||
740 | MHD_HTTP_VER_INVALID = -1, | ||
741 | |||
742 | /** | ||
743 | * HTTP version is not yet received from the client. | ||
744 | */ | ||
745 | MHD_HTTP_VER_UNKNOWN = 0, | ||
746 | |||
747 | /** | ||
748 | * HTTP version before 1.0, unsupported. | ||
749 | */ | ||
750 | MHD_HTTP_VER_TOO_OLD = 1, | ||
751 | |||
752 | /** | ||
753 | * HTTP version 1.0 | ||
754 | */ | ||
755 | MHD_HTTP_VER_1_0 = 2, | ||
756 | |||
757 | /** | ||
758 | * HTTP version 1.1 | ||
759 | */ | ||
760 | MHD_HTTP_VER_1_1 = 3, | ||
761 | |||
762 | /** | ||
763 | * HTTP version 1.2-1.9, must be used as 1.1 | ||
764 | */ | ||
765 | MHD_HTTP_VER_1_2__1_9 = 4, | ||
766 | |||
767 | /** | ||
768 | * HTTP future version. Unsupported. | ||
769 | * Reserved, not really detected. | ||
770 | */ | ||
771 | MHD_HTTP_VER_FUTURE = 100 | ||
772 | }; | ||
773 | |||
774 | /** | ||
775 | * Returns boolean 'true' if HTTP version is supported by MHD | ||
776 | */ | ||
777 | #define MHD_IS_HTTP_VER_SUPPORTED(ver) (MHD_HTTP_VER_1_0 <= (ver) && \ | ||
778 | MHD_HTTP_VER_1_2__1_9 >= (ver)) | ||
779 | |||
780 | /** | ||
781 | * Protocol should be used as HTTP/1.1 protocol. | ||
782 | * | ||
783 | * See the last paragraph of | ||
784 | * https://datatracker.ietf.org/doc/html/rfc7230#section-2.6 | ||
785 | */ | ||
786 | #define MHD_IS_HTTP_VER_1_1_COMPAT(ver) (MHD_HTTP_VER_1_1 == (ver) || \ | ||
787 | MHD_HTTP_VER_1_2__1_9 == (ver)) | ||
735 | 788 | ||
736 | /** | 789 | /** |
737 | * State kept for each HTTP request. | 790 | * State kept for each HTTP request. |
@@ -840,6 +893,11 @@ struct MHD_Connection | |||
840 | char *version; | 893 | char *version; |
841 | 894 | ||
842 | /** | 895 | /** |
896 | * HTTP protocol version as enum. | ||
897 | */ | ||
898 | enum MHD_HTTP_version http_ver; | ||
899 | |||
900 | /** | ||
843 | * Close connection after sending response? | 901 | * Close connection after sending response? |
844 | * Functions may change value from "Unknown" or "KeepAlive" to "Must close", | 902 | * Functions may change value from "Unknown" or "KeepAlive" to "Must close", |
845 | * but no functions reset value "Must Close" to any other value. | 903 | * but no functions reset value "Must Close" to any other value. |