diff options
Diffstat (limited to 'src/lib/internal.h')
-rw-r--r-- | src/lib/internal.h | 184 |
1 files changed, 165 insertions, 19 deletions
diff --git a/src/lib/internal.h b/src/lib/internal.h index c14d96eb..f5df8ce2 100644 --- a/src/lib/internal.h +++ b/src/lib/internal.h | |||
@@ -562,12 +562,6 @@ struct MHD_Request | |||
562 | enum MHD_RequestEventLoopInfo event_loop_info; | 562 | enum MHD_RequestEventLoopInfo event_loop_info; |
563 | 563 | ||
564 | /** | 564 | /** |
565 | * HTTP response code. Only valid if response object | ||
566 | * is already set. | ||
567 | */ | ||
568 | unsigned int responseCode; | ||
569 | |||
570 | /** | ||
571 | * Did we ever call the "default_handler" on this request? (this | 565 | * Did we ever call the "default_handler" on this request? (this |
572 | * flag will determine if we call the #MHD_OPTION_NOTIFY_COMPLETED | 566 | * flag will determine if we call the #MHD_OPTION_NOTIFY_COMPLETED |
573 | * handler when the request closes down). | 567 | * handler when the request closes down). |
@@ -594,16 +588,6 @@ struct MHD_Request | |||
594 | * be set to #MHD_NO again (before the final call to the handler). | 588 | * be set to #MHD_NO again (before the final call to the handler). |
595 | */ | 589 | */ |
596 | bool have_chunked_upload; | 590 | bool have_chunked_upload; |
597 | |||
598 | /** | ||
599 | * Is the request suspended? | ||
600 | */ | ||
601 | bool suspended; | ||
602 | |||
603 | /** | ||
604 | * Is the request wanting to resume? | ||
605 | */ | ||
606 | bool resuming; | ||
607 | }; | 591 | }; |
608 | 592 | ||
609 | 593 | ||
@@ -660,6 +644,15 @@ struct MHD_Connection | |||
660 | */ | 644 | */ |
661 | struct MHD_Request request; | 645 | struct MHD_Request request; |
662 | 646 | ||
647 | /** | ||
648 | * Is the connection suspended? | ||
649 | */ | ||
650 | bool suspended; | ||
651 | |||
652 | /** | ||
653 | * Is the connection wanting to resume? | ||
654 | */ | ||
655 | bool resuming; | ||
663 | 656 | ||
664 | /** | 657 | /** |
665 | * Set to `true` if the thread has been joined. | 658 | * Set to `true` if the thread has been joined. |
@@ -679,8 +672,7 @@ struct MHD_Connection | |||
679 | */ | 672 | */ |
680 | bool read_closed; | 673 | bool read_closed; |
681 | 674 | ||
682 | 675 | /** | |
683 | /** | ||
684 | * Length of the foreign address. | 676 | * Length of the foreign address. |
685 | */ | 677 | */ |
686 | socklen_t addr_len; | 678 | socklen_t addr_len; |
@@ -998,12 +990,166 @@ struct MHD_Daemon | |||
998 | */ | 990 | */ |
999 | bool allow_address_reuse; | 991 | bool allow_address_reuse; |
1000 | 992 | ||
1001 | 993 | ||
994 | }; | ||
995 | |||
996 | |||
997 | /** | ||
998 | * Action function implementing some action to be | ||
999 | * performed on a request. | ||
1000 | * | ||
1001 | * @param cls action-specfic closure | ||
1002 | * @param request the request on which the action is to be performed | ||
1003 | */ | ||
1004 | typedef void | ||
1005 | (*ActionCallback) (void *cls, | ||
1006 | const struct MHD_Request *request); | ||
1007 | |||
1008 | |||
1009 | /** | ||
1010 | * Actions are returned by the application to drive the request | ||
1011 | * handling of MHD. | ||
1012 | */ | ||
1013 | struct MHD_Action | ||
1014 | { | ||
1015 | |||
1016 | /** | ||
1017 | * Function to call for the action. | ||
1018 | */ | ||
1019 | ActionCallback action; | ||
1020 | |||
1021 | /** | ||
1022 | * Closure for @a action | ||
1023 | */ | ||
1024 | void *action_cls; | ||
1002 | 1025 | ||
1003 | }; | 1026 | }; |
1004 | 1027 | ||
1005 | 1028 | ||
1029 | /** | ||
1030 | * Representation of an HTTP response. | ||
1031 | */ | ||
1032 | struct MHD_Response | ||
1033 | { | ||
1034 | |||
1035 | /** | ||
1036 | * A response *is* an action. See also | ||
1037 | * #MHD_action_from_response(). Hence this field | ||
1038 | * must be the first field in a response! | ||
1039 | */ | ||
1040 | struct MHD_Action action; | ||
1041 | |||
1042 | /** | ||
1043 | * Headers to send for the response. Initially | ||
1044 | * the linked list is created in inverse order; | ||
1045 | * the order should be inverted before sending! | ||
1046 | */ | ||
1047 | struct MHD_HTTP_Header *first_header; | ||
1048 | |||
1049 | /** | ||
1050 | * Buffer pointing to data that we are supposed | ||
1051 | * to send as a response. | ||
1052 | */ | ||
1053 | char *data; | ||
1054 | |||
1055 | /** | ||
1056 | * Closure to give to the content reader @e crc | ||
1057 | * and content reader free callback @e crfc. | ||
1058 | */ | ||
1059 | void *crc_cls; | ||
1060 | |||
1061 | /** | ||
1062 | * How do we get more data? NULL if we are | ||
1063 | * given all of the data up front. | ||
1064 | */ | ||
1065 | MHD_ContentReaderCallback crc; | ||
1066 | |||
1067 | /** | ||
1068 | * NULL if data must not be freed, otherwise | ||
1069 | * either user-specified callback or "&free". | ||
1070 | */ | ||
1071 | MHD_ContentReaderFreeCallback crfc; | ||
1072 | |||
1073 | /** | ||
1074 | * Function to call once MHD is finished with | ||
1075 | * the request, may be NULL. | ||
1076 | */ | ||
1077 | MHD_RequestTerminationCallback termination_cb; | ||
1078 | |||
1079 | /** | ||
1080 | * Closure for @e termination_cb. | ||
1081 | */ | ||
1082 | void *termination_cb_cls; | ||
1083 | |||
1084 | #ifdef UPGRADE_SUPPORT | ||
1085 | /** | ||
1086 | * Application function to call once we are done sending the headers | ||
1087 | * of the response; NULL unless this is a response created with | ||
1088 | * #MHD_create_response_for_upgrade(). | ||
1089 | */ | ||
1090 | MHD_UpgradeHandler upgrade_handler; | ||
1091 | |||
1092 | /** | ||
1093 | * Closure for @e uh. | ||
1094 | */ | ||
1095 | void *upgrade_handler_cls; | ||
1096 | #endif /* UPGRADE_SUPPORT */ | ||
1097 | |||
1098 | /** | ||
1099 | * Mutex to synchronize access to @e data, @e size and | ||
1100 | * @e reference_count. | ||
1101 | */ | ||
1102 | MHD_mutex_ mutex; | ||
1103 | |||
1104 | /** | ||
1105 | * Set to #MHD_SIZE_UNKNOWN if size is not known. | ||
1106 | */ | ||
1107 | uint64_t total_size; | ||
1108 | |||
1109 | /** | ||
1110 | * At what offset in the stream is the | ||
1111 | * beginning of @e data located? | ||
1112 | */ | ||
1113 | uint64_t data_start; | ||
1114 | |||
1115 | /** | ||
1116 | * Offset to start reading from when using @e fd. | ||
1117 | */ | ||
1118 | uint64_t fd_off; | ||
1119 | |||
1120 | /** | ||
1121 | * Number of bytes ready in @e data (buffer may be larger | ||
1122 | * than what is filled with payload). | ||
1123 | */ | ||
1124 | size_t data_size; | ||
1125 | |||
1126 | /** | ||
1127 | * Size of the data buffer @e data. | ||
1128 | */ | ||
1129 | size_t data_buffer_size; | ||
1130 | |||
1131 | /** | ||
1132 | * HTTP status code of the response. | ||
1133 | */ | ||
1134 | enum MHD_HTTP_StatusCode status_code; | ||
1135 | |||
1136 | /** | ||
1137 | * Reference count for this response. Free once the counter hits | ||
1138 | * zero. | ||
1139 | */ | ||
1140 | unsigned int reference_count; | ||
1006 | 1141 | ||
1142 | /** | ||
1143 | * File-descriptor if this response is FD-backed. | ||
1144 | */ | ||
1145 | int fd; | ||
1146 | |||
1147 | /** | ||
1148 | * Only respond in HTTP 1.0 mode. | ||
1149 | */ | ||
1150 | bool v10_only; | ||
1151 | |||
1152 | }; | ||
1007 | 1153 | ||
1008 | 1154 | ||
1009 | 1155 | ||