summaryrefslogtreecommitdiffstats
path: root/nanohttp/nanohttp-mime.c
diff options
context:
space:
mode:
Diffstat (limited to 'nanohttp/nanohttp-mime.c')
-rwxr-xr-xnanohttp/nanohttp-mime.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/nanohttp/nanohttp-mime.c b/nanohttp/nanohttp-mime.c
index 2089348..2cf059c 100755
--- a/nanohttp/nanohttp-mime.c
+++ b/nanohttp/nanohttp-mime.c
@@ -3,7 +3,7 @@
* | \/ | | | | \/ | | _/
* |_''_| |_| |_''_| |_'/ PARSER
*
-* $Id: nanohttp-mime.c,v 1.5 2004/11/01 15:16:26 snowdrop Exp $
+* $Id: nanohttp-mime.c,v 1.6 2004/11/02 23:09:26 snowdrop Exp $
*
* CSOAP Project: A http client/server library in C
* Copyright (C) 2003-2004 Ferhat Ayaz
@@ -509,18 +509,18 @@ MIME_read_status mime_streamreader_function(void* userdata,
if (!http_input_stream_is_ready(in))
return MIME_READ_EOF;
- readed = http_input_stream_read(in, dest, *size);
- /*
- log_info1("http_input_stream_read() returned 0");
- */
- if (readed == -1) {
- log_error4("[%d] %s():%s ", herror_code(in->err), herror_func(in->err), herror_message(in->err));
- }
+ readed = http_input_stream_read(in, dest, *size);
+ /*
+ log_info1("http_input_stream_read() returned 0");
+ */
+ if (readed == -1) {
+ log_error4("[%d] %s():%s ", herror_code(in->err), herror_func(in->err), herror_message(in->err));
+ }
*size = readed;
- if (*size!=-1) {
+ if (*size!=-1) {
/*
- _log_str("reader.log", dest, *size);
+ _log_str("reader.log", dest, *size);
*/
return MIME_READ_OK;
}
@@ -582,8 +582,8 @@ void _mime_part_begin(void *data)
sprintf(buffer, "%s/mime_%p_%d.part", cbdata->root_dir,
cbdata, cbdata->part_id++);
#endif
-
-/* log_info2("Creating FILE ('%s') deleteOnExit=1", buffer);*/
+
+/* log_info2("Creating FILE ('%s') deleteOnExit=1", buffer);*/
part->deleteOnExit = 1;
cbdata->current_fd = fopen(buffer, "wb");
if (cbdata->current_fd)
@@ -730,23 +730,23 @@ void _mime_received_bytes(void *data, const unsigned char* bytes, int size)
cbdata->current_part->header = _mime_process_header(cbdata->header);
hpairnode_dump_deep(cbdata->current_part->header);
/* set id */
- id = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_ID);
- if (id != NULL)
- {
- strcpy(cbdata->current_part->id, id);
- if (!strcmp(id, cbdata->root_id))
- cbdata->message->root_part = cbdata->current_part;
- }
- location = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_LOCATION);
- if (location != NULL)
- {
- strcpy(cbdata->current_part->location, location);
- }
- type = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_TYPE);
- if (type != NULL)
- {
- strcpy(cbdata->current_part->content_type, type);
- }
+ id = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_ID);
+ if (id != NULL)
+ {
+ strcpy(cbdata->current_part->id, id);
+ if (!strcmp(id, cbdata->root_id))
+ cbdata->message->root_part = cbdata->current_part;
+ }
+ location = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_LOCATION);
+ if (location != NULL)
+ {
+ strcpy(cbdata->current_part->location, location);
+ }
+ type = hpairnode_get(cbdata->current_part->header, HEADER_CONTENT_TYPE);
+ if (type != NULL)
+ {
+ strcpy(cbdata->current_part->content_type, type);
+ }
i++;
break;
}
@@ -884,7 +884,7 @@ herror_t mime_get_attachments(content_type_t *ctype, http_input_stream_t *in, at
/* Check for MIME message */
if (!(ctype &&
!strcmp(ctype->type, "multipart/related")))
- return herror_new("mime_get_attachments", MIME_ERROR_NOT_MIME_MESSAGE,
+ return herror_new("mime_get_attachments", MIME_ERROR_NOT_MIME_MESSAGE,
"Not a MIME message '%s'", ctype->type);
boundary = hpairnode_get(ctype->params, "boundary");
@@ -893,7 +893,7 @@ herror_t mime_get_attachments(content_type_t *ctype, http_input_stream_t *in, at
{
/* TODO (#1#): Handle Error in http form */
log_error1("'boundary' not set for multipart/related");
- return herror_new("mime_get_attachments", MIME_ERROR_NO_BOUNDARY_PARAM,
+ return herror_new("mime_get_attachments", MIME_ERROR_NO_BOUNDARY_PARAM,
"'boundary' not set for multipart/related");
}
@@ -901,8 +901,8 @@ herror_t mime_get_attachments(content_type_t *ctype, http_input_stream_t *in, at
{
/* TODO (#1#): Handle Error in http form */
log_error1("'start' not set for multipart/related");
- return herror_new("mime_get_attachments", MIME_ERROR_NO_START_PARAM,
- "'start' not set for multipart/related");
+ return herror_new("mime_get_attachments", MIME_ERROR_NO_START_PARAM,
+ "'start' not set for multipart/related");
}
mimeMessage = mime_message_parse(in, root_id, boundary, hoption_get(HOPTION_TMP_DIR));
@@ -910,7 +910,7 @@ herror_t mime_get_attachments(content_type_t *ctype, http_input_stream_t *in, at
{
/* TODO (#1#): Handle Error in http form */
log_error1("MIME Parse Error");
- return herror_new("mime_get_attachments", MIME_ERROR_PARSE_ERROR,
+ return herror_new("mime_get_attachments", MIME_ERROR_PARSE_ERROR,
"MIME Parse Error");
}
@@ -918,7 +918,7 @@ herror_t mime_get_attachments(content_type_t *ctype, http_input_stream_t *in, at
if (!mimeMessage->root_part)
{
attachments_free(mimeMessage);
- return herror_new("mime_get_attachments", MIME_ERROR_NO_ROOT_PART,
+ return herror_new("mime_get_attachments", MIME_ERROR_NO_ROOT_PART,
"No root part found!");
}