Hi Sasha,

On Thu, Mar 06, 2014 at 05:53:30PM -0700, Sasha Pachev wrote:
> I am looking at this code in src/proto_http.c in the development tree:
> 
> case HTTP_REQ_ACT_ADD_HDR:
> chunk_printf(&trash, "%s: ", rule->arg.hdr_add.name);
> memcpy(trash.str, rule->arg.hdr_add.name, rule->arg.hdr_add.name_len);
> trash.len = rule->arg.hdr_add.name_len;
> trash.str[trash.len++] = ':';
> trash.str[trash.len++] = ' ';
> trash.len += build_logline(s, trash.str + trash.len, trash.size -
> trash.len, &rule->arg.hdr_add.fmt);
> http_header_add_tail2(&txn->req, &txn->hdr_idx, trash.str, trash.len);
> 
> Looks like chunk_printf() call is redundant as it does the same thing
> as memcpy() + manual trash.str fixing later on.

Ah yes you're right. I just checked the history to see if one was added
before the other one or whatever, and no, both were merged with the
feature at the same time in commit 20b0de56.

I suspect that I first used chunk_printf() and realized that it would
be faster done by hand since we had everything for this, and that I
forgot to remove the chunk_printf(). Feel free to send a patch to
remove it.

Thanks,
Willy


Reply via email to