aboutsummaryrefslogtreecommitdiff
path: root/src/microhttpd/internal.h
diff options
context:
space:
mode:
authorEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-07-28 15:21:19 +0300
committerEvgeny Grin (Karlson2k) <k2k@narod.ru>2022-08-09 21:24:53 +0300
commit82d864759c08796d36139336df070b62b1a0e077 (patch)
tree273803573b29dad65f660dab2035ea27526163aa /src/microhttpd/internal.h
parent93ef4701123acd9c3f606b4d983dbaa840f427b4 (diff)
downloadlibmicrohttpd-82d864759c08796d36139336df070b62b1a0e077.tar.gz
libmicrohttpd-82d864759c08796d36139336df070b62b1a0e077.zip
Internal refactoring: moved all reply-related members to separate structure
Diffstat (limited to 'src/microhttpd/internal.h')
-rw-r--r--src/microhttpd/internal.h102
1 files changed, 59 insertions, 43 deletions
diff --git a/src/microhttpd/internal.h b/src/microhttpd/internal.h
index b7d67e14..d892c1e4 100644
--- a/src/microhttpd/internal.h
+++ b/src/microhttpd/internal.h
@@ -1050,6 +1050,63 @@ struct MHD_Reply_Properties
1050 bool chunked; /**< Use chunked encoding for reply */ 1050 bool chunked; /**< Use chunked encoding for reply */
1051}; 1051};
1052 1052
1053#if defined(_MHD_HAVE_SENDFILE)
1054enum MHD_resp_sender_
1055{
1056 MHD_resp_sender_std = 0,
1057 MHD_resp_sender_sendfile
1058};
1059#endif /* _MHD_HAVE_SENDFILE */
1060
1061/**
1062 * Reply-specific values.
1063 *
1064 * Meaningful for the current reply only.
1065 */
1066struct MHD_Reply
1067{
1068 /**
1069 * Response to transmit (initially NULL).
1070 */
1071 struct MHD_Response *response;
1072
1073 /**
1074 * HTTP response code. Only valid if response object
1075 * is already set.
1076 */
1077 unsigned int responseCode;
1078
1079 /**
1080 * The "ICY" response.
1081 * Reply begins with the SHOUTcast "ICY" line instead of "HTTP".
1082 */
1083 bool responseIcy;
1084
1085 /**
1086 * Current write position in the actual response
1087 * (excluding headers, content only; should be 0
1088 * while sending headers).
1089 */
1090 uint64_t rsp_write_position;
1091
1092 /**
1093 * The copy of iov response.
1094 * Valid if iovec response is used.
1095 * Updated during send.
1096 * Members are allocated in the pool.
1097 */
1098 struct MHD_iovec_track_ resp_iov;
1099
1100#if defined(_MHD_HAVE_SENDFILE)
1101 enum MHD_resp_sender_ resp_sender;
1102#endif /* _MHD_HAVE_SENDFILE */
1103
1104 /**
1105 * Reply-specific properties
1106 */
1107 struct MHD_Reply_Properties props;
1108};
1109
1053/** 1110/**
1054 * State kept for each HTTP request. 1111 * State kept for each HTTP request.
1055 */ 1112 */
@@ -1103,9 +1160,9 @@ struct MHD_Connection
1103 struct MHD_Request rq; 1160 struct MHD_Request rq;
1104 1161
1105 /** 1162 /**
1106 * Response to transmit (initially NULL). 1163 * Reply-specific data
1107 */ 1164 */
1108 struct MHD_Response *response; 1165 struct MHD_Reply rp;
1109 1166
1110 /** 1167 /**
1111 * The memory pool is created whenever we first read from the TCP 1168 * The memory pool is created whenever we first read from the TCP
@@ -1198,30 +1255,6 @@ struct MHD_Connection
1198 size_t write_buffer_append_offset; 1255 size_t write_buffer_append_offset;
1199 1256
1200 /** 1257 /**
1201 * Current write position in the actual response
1202 * (excluding headers, content only; should be 0
1203 * while sending headers).
1204 */
1205 uint64_t response_write_position;
1206
1207 /**
1208 * The copy of iov response.
1209 * Valid if iovec response is used.
1210 * Updated during send.
1211 * Members are allocated in the pool.
1212 */
1213 struct MHD_iovec_track_ resp_iov;
1214
1215
1216#if defined(_MHD_HAVE_SENDFILE)
1217 enum MHD_resp_sender_
1218 {
1219 MHD_resp_sender_std = 0,
1220 MHD_resp_sender_sendfile
1221 } resp_sender;
1222#endif /* _MHD_HAVE_SENDFILE */
1223
1224 /**
1225 * Position in the 100 CONTINUE message that 1258 * Position in the 100 CONTINUE message that
1226 * we need to send when receiving http 1.1 requests. 1259 * we need to send when receiving http 1.1 requests.
1227 */ 1260 */
@@ -1340,23 +1373,6 @@ struct MHD_Connection
1340 enum MHD_ConnectionEventLoopInfo event_loop_info; 1373 enum MHD_ConnectionEventLoopInfo event_loop_info;
1341 1374
1342 /** 1375 /**
1343 * HTTP response code. Only valid if response object
1344 * is already set.
1345 */
1346 unsigned int responseCode;
1347
1348 /**
1349 * The "ICY" response.
1350 * Reply begins with the SHOUTcast "ICY" line instead of "HTTP".
1351 */
1352 bool responseIcy;
1353
1354 /**
1355 * Reply-specific properties
1356 */
1357 struct MHD_Reply_Properties rp_props;
1358
1359 /**
1360 * Function used for reading HTTP request stream. 1376 * Function used for reading HTTP request stream.
1361 */ 1377 */
1362 ReceiveCallback recv_cls; 1378 ReceiveCallback recv_cls;