diff options
Diffstat (limited to 'src/lib/request_info.c')
-rw-r--r-- | src/lib/request_info.c | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/src/lib/request_info.c b/src/lib/request_info.c index 4a903ef0..a7342e0a 100644 --- a/src/lib/request_info.c +++ b/src/lib/request_info.c | |||
@@ -46,7 +46,41 @@ MHD_request_get_information_sz (struct MHD_Request *request, | |||
46 | union MHD_RequestInformation *return_value, | 46 | union MHD_RequestInformation *return_value, |
47 | size_t return_value_size) | 47 | size_t return_value_size) |
48 | { | 48 | { |
49 | return MHD_NO; /* not implemented */ | 49 | #define CHECK_SIZE(type) if (sizeof(type) < return_value_size) \ |
50 | return MHD_NO | ||
51 | |||
52 | switch (info_type) | ||
53 | { | ||
54 | case MHD_REQUEST_INFORMATION_CONNECTION: | ||
55 | CHECK_SIZE (struct MHD_Connection *); | ||
56 | return_value->connection = request->connection; | ||
57 | return MHD_YES; | ||
58 | case MHD_REQUEST_INFORMATION_CLIENT_CONTEXT: | ||
59 | CHECK_SIZE (void **); | ||
60 | return_value->request_context = &request->client_context; | ||
61 | return MHD_YES; | ||
62 | case MHD_REQUEST_INFORMATION_HTTP_VERSION: | ||
63 | CHECK_SIZE (const char *); | ||
64 | return_value->http_version = request->version_s; | ||
65 | return MHD_YES; | ||
66 | case MHD_REQUEST_INFORMATION_HTTP_METHOD: | ||
67 | CHECK_SIZE (const char *); | ||
68 | return_value->http_method = request->method_s; | ||
69 | return MHD_YES; | ||
70 | case MHD_REQUEST_INFORMATION_HEADER_SIZE: | ||
71 | CHECK_SIZE (size_t); | ||
72 | if ( (MHD_REQUEST_HEADERS_RECEIVED > request->state) || | ||
73 | (MHD_REQUEST_CLOSED == request->state) || | ||
74 | (MHD_REQUEST_IN_CLEANUP == request->state) ) | ||
75 | return MHD_NO; /* invalid, too early! */ | ||
76 | return_value->header_size = request->header_size; | ||
77 | return MHD_YES; | ||
78 | |||
79 | default: | ||
80 | return MHD_NO; | ||
81 | } | ||
82 | |||
83 | #undef CHECK_SIZE | ||
50 | } | 84 | } |
51 | 85 | ||
52 | 86 | ||