mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-21 22:01:31 +02:00
MINOR: http/htx: Use sl_pos directly to replace the start-line
Since the HTX start-line is now referenced by position instead of by its payload address, it is fairly easier to replace it. No need to search the rigth block to find the start-line comparing the payloads address. It just enough to get the block at the position sl_pos.
This commit is contained in:
parent
dd2ad8518f
commit
7b7d507a5b
@ -174,25 +174,17 @@ int http_add_header(struct htx *htx, const struct ist n, const struct ist v)
|
|||||||
*/
|
*/
|
||||||
int http_replace_stline(struct htx *htx, const struct ist p1, const struct ist p2, const struct ist p3)
|
int http_replace_stline(struct htx *htx, const struct ist p1, const struct ist p2, const struct ist p3)
|
||||||
{
|
{
|
||||||
int32_t pos;
|
struct htx_blk *blk;
|
||||||
|
|
||||||
for (pos = htx_get_head(htx); pos != -1; pos = htx_get_next(htx, pos)) {
|
if (htx->sl_pos == -1)
|
||||||
struct htx_blk *blk = htx_get_blk(htx, pos);
|
return 0;
|
||||||
enum htx_blk_type type = htx_get_blk_type(blk);
|
|
||||||
|
|
||||||
if (htx->sl_pos == pos) {
|
blk = htx_get_blk(htx, htx->sl_pos);
|
||||||
if (!htx_replace_stline(htx, blk, p1, p2, p3))
|
if (!htx_replace_stline(htx, blk, p1, p2, p3))
|
||||||
return 0;
|
return 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == HTX_BLK_EOM)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Replace the request method in the HTX message <htx> by <meth>. It returns 1
|
/* Replace the request method in the HTX message <htx> by <meth>. It returns 1
|
||||||
* on success, otherwise 0.
|
* on success, otherwise 0.
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user