diff options
author | Sebastian Gerhardt <sebgerhardt@gmx.net> | 2008-08-19 13:03:27 +0000 |
---|---|---|
committer | Sebastian Gerhardt <sebgerhardt@gmx.net> | 2008-08-19 13:03:27 +0000 |
commit | 45c6900e368f4269b2eb435eab32d9f5e98da072 (patch) | |
tree | af06912b886461e0700ed74b2c424781aa993e99 /doc | |
parent | 57f2c46ede626e2e4334f3063195b425e74548f2 (diff) | |
download | libmicrohttpd-45c6900e368f4269b2eb435eab32d9f5e98da072.tar.gz libmicrohttpd-45c6900e368f4269b2eb435eab32d9f5e98da072.zip |
corrected error handling in post processing example
Diffstat (limited to 'doc')
-rw-r--r-- | doc/examples/simplepost.c | 7 | ||||
-rw-r--r-- | doc/processingpost.inc | 6 |
2 files changed, 9 insertions, 4 deletions
diff --git a/doc/examples/simplepost.c b/doc/examples/simplepost.c index ee41fdf4..8df0a94d 100644 --- a/doc/examples/simplepost.c +++ b/doc/examples/simplepost.c | |||
@@ -86,7 +86,8 @@ void request_completed (void *cls, struct MHD_Connection *connection, void **con | |||
86 | if (con_info->answerstring) free (con_info->answerstring); | 86 | if (con_info->answerstring) free (con_info->answerstring); |
87 | } | 87 | } |
88 | 88 | ||
89 | free (con_info); | 89 | free (con_info); |
90 | *con_cls = NULL; | ||
90 | } | 91 | } |
91 | 92 | ||
92 | 93 | ||
@@ -100,6 +101,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection, const ch | |||
100 | 101 | ||
101 | con_info = malloc (sizeof (struct connection_info_struct)); | 102 | con_info = malloc (sizeof (struct connection_info_struct)); |
102 | if (NULL == con_info) return MHD_NO; | 103 | if (NULL == con_info) return MHD_NO; |
104 | con_info->answerstring = NULL; | ||
103 | 105 | ||
104 | if (0 == strcmp (method, "POST")) | 106 | if (0 == strcmp (method, "POST")) |
105 | { | 107 | { |
@@ -137,7 +139,8 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection, const ch | |||
137 | 139 | ||
138 | return MHD_YES; | 140 | return MHD_YES; |
139 | } | 141 | } |
140 | else return send_page (connection, con_info->answerstring); | 142 | else |
143 | if (NULL != con_info->answerstring) return send_page (connection, con_info->answerstring); | ||
141 | } | 144 | } |
142 | 145 | ||
143 | return send_page(connection, errorpage); | 146 | return send_page(connection, errorpage); |
diff --git a/doc/processingpost.inc b/doc/processingpost.inc index dbbe76b2..0677c7e8 100644 --- a/doc/processingpost.inc +++ b/doc/processingpost.inc | |||
@@ -122,7 +122,8 @@ void request_completed (void *cls, struct MHD_Connection *connection, void **con | |||
122 | if (con_info->answerstring) free (con_info->answerstring); | 122 | if (con_info->answerstring) free (con_info->answerstring); |
123 | } | 123 | } |
124 | 124 | ||
125 | free (con_info); | 125 | free (con_info); |
126 | *con_cls = NULL; | ||
126 | } | 127 | } |
127 | @end verbatim | 128 | @end verbatim |
128 | @noindent | 129 | @noindent |
@@ -157,6 +158,7 @@ int answer_to_connection (void *cls, struct MHD_Connection *connection, const ch | |||
157 | 158 | ||
158 | con_info = malloc (sizeof (struct connection_info_struct)); | 159 | con_info = malloc (sizeof (struct connection_info_struct)); |
159 | if (NULL == con_info) return MHD_NO; | 160 | if (NULL == con_info) return MHD_NO; |
161 | con_info->answerstring = NULL; | ||
160 | @end verbatim | 162 | @end verbatim |
161 | @noindent | 163 | @noindent |
162 | 164 | ||
@@ -214,7 +216,7 @@ considered---all of it. | |||
214 | 216 | ||
215 | return MHD_YES; | 217 | return MHD_YES; |
216 | } | 218 | } |
217 | else return send_page (connection, con_info->answerstring); | 219 | else if (NULL != con_info->answerstring) return send_page (connection, con_info->answerstring); |
218 | } | 220 | } |
219 | @end verbatim | 221 | @end verbatim |
220 | @noindent | 222 | @noindent |