1
0
mirror of https://github.com/lammertb/libhttp.git synced 2025-08-12 01:22:40 +03:00

Added debug levels to warnings

This commit is contained in:
Lammert Bies
2016-12-29 03:10:24 +01:00
parent 0e4deecb3e
commit a03f2e301f
38 changed files with 118 additions and 111 deletions

View File

@@ -55,7 +55,7 @@ static int url_encoded_field_found(const struct httplib_connection *conn,
* Log error message and skip this field.
*/
httplib_cry( conn->ctx, conn, "%s: Cannot decode filename", __func__ );
httplib_cry( DEBUG_LEVEL_WARNING, conn->ctx, conn, "%s: Cannot decode filename", __func__ );
return FORM_FIELD_STORAGE_SKIP;
}
@@ -67,7 +67,7 @@ static int url_encoded_field_found(const struct httplib_connection *conn,
if ( fdh->field_get == NULL ) {
httplib_cry( conn->ctx, conn, "%s: Function \"Get\" not available", __func__ );
httplib_cry( DEBUG_LEVEL_WARNING, conn->ctx, conn, "%s: Function \"Get\" not available", __func__ );
return FORM_FIELD_STORAGE_SKIP;
}
}
@@ -75,7 +75,7 @@ static int url_encoded_field_found(const struct httplib_connection *conn,
if ( fdh->field_store == NULL ) {
httplib_cry( conn->ctx, conn, "%s: Function \"Store\" not available", __func__ );
httplib_cry( DEBUG_LEVEL_WARNING, conn->ctx, conn, "%s: Function \"Store\" not available", __func__ );
return FORM_FIELD_STORAGE_SKIP;
}
}
@@ -103,7 +103,7 @@ static int url_encoded_field_get(const struct httplib_connection *conn,
* Log error message and stop parsing the form data.
*/
httplib_cry( conn->ctx, conn, "%s: Not enough memory (required: %lu)", __func__, (unsigned long)(value_len + 1));
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Not enough memory (required: %lu)", __func__, (unsigned long)(value_len + 1));
return FORM_FIELD_STORAGE_ABORT;
}
@@ -282,7 +282,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
size_t n = (size_t)fwrite(val, 1, (size_t)vallen, fstore.fp);
if ((n != (size_t)vallen) || (ferror(fstore.fp))) {
httplib_cry( conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
fclose( fstore.fp );
fstore.fp = NULL;
XX_httplib_remove_bad_file( conn, path );
@@ -302,14 +302,14 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
}
else {
httplib_cry( conn->ctx, conn, "%s: Error saving file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Error saving file %s", __func__, path );
XX_httplib_remove_bad_file( conn, path );
}
fstore.fp = NULL;
}
} else httplib_cry( conn->ctx, conn, "%s: Cannot create file %s", __func__, path );
} else httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot create file %s", __func__, path );
}
/*
@@ -410,7 +410,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
if (XX_httplib_fopen(conn, path, "wb", &fstore) == 0) fstore.fp = NULL;
file_size = 0;
if (!fstore.fp) httplib_cry( conn->ctx, conn, "%s: Cannot create file %s", __func__, path);
if (!fstore.fp) httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot create file %s", __func__, path);
}
get_block = 0;
@@ -455,7 +455,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
if ( fstore.fp ) {
size_t n = (size_t)fwrite(val, 1, (size_t)vallen, fstore.fp);
if ((n != (size_t)vallen) || (ferror(fstore.fp))) {
httplib_cry( conn->ctx, conn, "%s: Cannot write file %s", __func__, path);
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot write file %s", __func__, path);
fclose(fstore.fp);
fstore.fp = NULL;
XX_httplib_remove_bad_file(conn, path);
@@ -506,7 +506,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
}
else {
httplib_cry( conn->ctx, conn, "%s: Error saving file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Error saving file %s", __func__, path );
XX_httplib_remove_bad_file( conn, path );
}
@@ -708,7 +708,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
if ( XX_httplib_fopen( conn, path, "wb", &fstore ) == 0 ) fstore.fp = NULL;
file_size = 0;
if ( ! fstore.fp ) httplib_cry( conn->ctx, conn, "%s: Cannot create file %s", __func__, path );
if ( ! fstore.fp ) httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot create file %s", __func__, path );
}
get_block = 0;
@@ -752,7 +752,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
if ( n != towrite || ferror( fstore.fp ) ) {
httplib_cry( conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
fclose( fstore.fp );
fstore.fp = NULL;
XX_httplib_remove_bad_file( conn, path );
@@ -808,7 +808,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
if ( n != towrite || ferror( fstore.fp ) ) {
httplib_cry( conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Cannot write file %s", __func__, path );
fclose( fstore.fp );
fstore.fp = NULL;
XX_httplib_remove_bad_file( conn, path );
@@ -832,7 +832,7 @@ int httplib_handle_form_request(struct httplib_connection *conn, struct httplib_
}
else {
httplib_cry( conn->ctx, conn, "%s: Error saving file %s", __func__, path );
httplib_cry( DEBUG_LEVEL_ERROR, conn->ctx, conn, "%s: Error saving file %s", __func__, path );
XX_httplib_remove_bad_file( conn, path );
}
fstore.fp = NULL;