mirror of
https://git.gnunet.org/libmicrohttpd.git
synced 2026-09-25 04:09:31 +03:00
extra error checking
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
Sat Aug 18 03:06:09 MDT 2007
|
||||
Check for out of memory when adding headers to
|
||||
responses. Check for NULL key when looking
|
||||
for headers. - CG
|
||||
|
||||
Wed Aug 15 01:46:44 MDT 2007
|
||||
Extending API to allow timeout of connections.
|
||||
Changed API (MHD_create_response_from_callback) to
|
||||
|
||||
@@ -50,8 +50,19 @@ MHD_add_response_header (struct MHD_Response *response,
|
||||
(NULL != strstr (content, "\r")) || (NULL != strstr (content, "\n")))
|
||||
return MHD_NO;
|
||||
hdr = malloc (sizeof (struct MHD_HTTP_Header));
|
||||
if (hdr == NULL)
|
||||
return MHD_NO;
|
||||
hdr->header = strdup (header);
|
||||
if (hdr->header == NULL) {
|
||||
free(hdr);
|
||||
return MHD_NO;
|
||||
}
|
||||
hdr->value = strdup (content);
|
||||
if (hdr->value == NULL) {
|
||||
free(hdr->header);
|
||||
free(hdr);
|
||||
return MHD_NO;
|
||||
}
|
||||
hdr->kind = MHD_HEADER_KIND;
|
||||
hdr->next = response->first_header;
|
||||
response->first_header = hdr;
|
||||
@@ -132,6 +143,9 @@ const char *
|
||||
MHD_get_response_header (struct MHD_Response *response, const char *key)
|
||||
{
|
||||
struct MHD_HTTP_Header *pos;
|
||||
|
||||
if (key == NULL)
|
||||
return NULL;
|
||||
pos = response->first_header;
|
||||
while (pos != NULL)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user