Skip to content

Commit

Permalink
Ignore anything with an empty filename.
Browse files Browse the repository at this point in the history
  • Loading branch information
minfrin committed Oct 27, 2021
1 parent 612f61d commit 9720104
Showing 1 changed file with 58 additions and 51 deletions.
109 changes: 58 additions & 51 deletions mod_contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -1489,63 +1489,70 @@ contact_in_filter(ap_filter_t * f, apr_bucket_brigade * bb,
ctx->contact = NULL;
}

/* write out mime start */
apr_brigade_printf(ctx->out, NULL, NULL,
CRLF "--%s" CRLF, ctx->boundary);

if (h->part->ct) {
apr_brigade_puts(ctx->out, NULL, NULL, "Content-Type: ");
apr_brigade_puts(ctx->out, NULL, NULL, h->part->ct);
if (h->part->ct_boundary) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; boundary=\"%s\"", h->part->ct_boundary);
}
if (h->part->ct_charset) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; charset=\"%s\"", h->part->ct_charset);
}
apr_brigade_puts(ctx->out, NULL, NULL,
CRLF);
/* ignore empty files */
if (!h->part->dsp_filename || !h->part->dsp_filename[0]) {
ctx->ignore = 1;
}
else {

if (h->part->dsp) {
apr_brigade_puts(ctx->out, NULL, NULL, "Content-Disposition: ");
if (h->part->dsp_name[8] == 'a' || h->part->dsp_name[8] == 'A') {
apr_brigade_puts(ctx->out, NULL, NULL, "attachment");
}
else {
apr_brigade_puts(ctx->out, NULL, NULL, "inline");
}
if (h->part->dsp_filename) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; filename=\"%s\"", h->part->dsp_filename);
}
if (h->part->dsp_create) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; creation-date=\"%s\"", h->part->dsp_create);
}
if (h->part->dsp_mod) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; modification-date=\"%s\"", h->part->dsp_mod);
}
if (h->part->dsp_read) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; read-date=\"%s\"", h->part->dsp_read);
/* write out mime start */
apr_brigade_printf(ctx->out, NULL, NULL,
CRLF "--%s" CRLF, ctx->boundary);

if (h->part->ct) {
apr_brigade_puts(ctx->out, NULL, NULL, "Content-Type: ");
apr_brigade_puts(ctx->out, NULL, NULL, h->part->ct);
if (h->part->ct_boundary) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; boundary=\"%s\"", h->part->ct_boundary);
}
if (h->part->ct_charset) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; charset=\"%s\"", h->part->ct_charset);
}
apr_brigade_puts(ctx->out, NULL, NULL,
CRLF);
}
if (h->part->dsp_size) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; size=\"%s\"", h->part->dsp_size);

if (h->part->dsp) {
apr_brigade_puts(ctx->out, NULL, NULL, "Content-Disposition: ");
if (h->part->dsp_name[8] == 'a' || h->part->dsp_name[8] == 'A') {
apr_brigade_puts(ctx->out, NULL, NULL, "attachment");
}
else {
apr_brigade_puts(ctx->out, NULL, NULL, "inline");
}
if (h->part->dsp_filename) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; filename=\"%s\"", h->part->dsp_filename);
}
if (h->part->dsp_create) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; creation-date=\"%s\"", h->part->dsp_create);
}
if (h->part->dsp_mod) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; modification-date=\"%s\"", h->part->dsp_mod);
}
if (h->part->dsp_read) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; read-date=\"%s\"", h->part->dsp_read);
}
if (h->part->dsp_size) {
apr_brigade_printf(ctx->out, NULL, NULL,
"; size=\"%s\"", h->part->dsp_size);
}
apr_brigade_puts(ctx->out, NULL, NULL,
CRLF);
}
apr_brigade_puts(ctx->out, NULL, NULL,
CRLF);
}

apr_brigade_puts(ctx->out, NULL, NULL,
"Content-Transfer-Encoding: base64" CRLF CRLF);
apr_brigade_puts(ctx->out, NULL, NULL,
"Content-Transfer-Encoding: base64" CRLF CRLF);

ctx->in_mime = 1;
ctx->in_base64 = 1;
ctx->state = CONTACT_ATTACHMENT;
ctx->in_mime = 1;
ctx->in_base64 = 1;
ctx->state = CONTACT_ATTACHMENT;
}
}

else {
Expand Down

0 comments on commit 9720104

Please sign in to comment.