/* Replaces an header by a new one. The new header can be smaller or larger than
* the old one. It returns the new block on success, otherwise it returns NULL.
+ * The header name is always lower cased.
*/
struct htx_blk *htx_replace_header(struct htx *htx, struct htx_blk *blk,
const struct ist name, const struct ist value)
return NULL;
blk->info = (type << 28) + (value.len << 8) + name.len;
- memcpy(htx_get_blk_ptr(htx, blk), name.ptr, name.len);
+ ist2bin_lc(htx_get_blk_ptr(htx, blk), name);
memcpy(htx_get_blk_ptr(htx, blk) + name.len, value.ptr, value.len);
return blk;
}
/* Adds an HTX block of type HDR in <htx>. It returns the new block on
- * success. Otherwise, it returns NULL.
+ * success. Otherwise, it returns NULL. The header name is always lower cased.
*/
struct htx_blk *htx_add_header(struct htx *htx, const struct ist name,
const struct ist value)
return NULL;
blk->info += (value.len << 8) + name.len;
- memcpy(htx_get_blk_ptr(htx, blk), name.ptr, name.len);
+ ist2bin_lc(htx_get_blk_ptr(htx, blk), name);
memcpy(htx_get_blk_ptr(htx, blk) + name.len, value.ptr, value.len);
return blk;
}