diff options
Diffstat (limited to 'doc/chapters/hellobrowser.inc')
-rw-r--r-- | doc/chapters/hellobrowser.inc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/doc/chapters/hellobrowser.inc b/doc/chapters/hellobrowser.inc index 3c77c806..58597786 100644 --- a/doc/chapters/hellobrowser.inc +++ b/doc/chapters/hellobrowser.inc | |||
@@ -155,12 +155,17 @@ implemented by checking if the parameter @code{method} equals the string "GET" a | |||
155 | @code{MHD_NO} if not so. | 155 | @code{MHD_NO} if not so. |
156 | 156 | ||
157 | Secondly, the above practice of queuing a response upon the first call of the callback function | 157 | Secondly, the above practice of queuing a response upon the first call of the callback function |
158 | brings with it some limitations. This is because the content of the message body will not be | 158 | brings with it some limitations. This is because the content of the message body will not be |
159 | received if a response is queued in the first iteration. Furthermore, the connection will be closed | 159 | received if a response is queued in the first iteration. Furthermore, the connection will be closed |
160 | right after the response has been transferred then. | 160 | right after the response has been transferred then. This is typically not what you want as it |
161 | disables HTTP pipelining. The correct approach is to simply not queue a message on the first | ||
162 | callback unless there is an error. The @code{void**} argument to the callback provides a location | ||
163 | for storing information about the history of the connection; for the first call, the pointer | ||
164 | will point to NULL. A simplistic way to differenciate the first call from others is to check | ||
165 | if the pointer is NULL and set it to a non-NULL value during the first call. | ||
161 | 166 | ||
162 | Both of these issues you will find addressed in the official @code{minimal_example.c} residing in | 167 | Both of these issues you will find addressed in the official @code{minimal_example.c} residing in |
163 | the @code{src/examples} directory of the @emph{MHD} package. The source code of this | 168 | the @code{src/examples} directory of the @emph{MHD} package. The source code of this |
164 | program should look very familiar to you by now and easy to understand. | 169 | program should look very familiar to you by now and easy to understand. |
165 | 170 | ||
166 | For our example, the @code{must_copy} and @code{must_free} parameter at the response construction | 171 | For our example, the @code{must_copy} and @code{must_free} parameter at the response construction |