mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-04-27 21:43:06 +00:00
BUG/MINOR: http_htx: Remove BUG_ON() from http_get_stline() function
The http_get_stline() was designed to be called from HTTP analyzers. Thus before any data forwarding. To prevent any invalid usage, two BUG_ON() statements were added. However, it is not a good idea because it is pretty hard to be sure no HTTP sample fetch will never be called outside the analyzers context. Especially because there is at least one possible area where it may happens. An HTTP sample fetch may be used inside the unique-id format string. On the normal case, it is generated in AN_REQ_HTTP_INNER analyzer. But if an error is reported too early, the id is generated when the log is emitted. So, it is safer to remove the BUG_ON() statements and consider the normal behavior is to return NULL if the first block is not a start-line. Of course, this means all calling functions must test the return value or be sure the start-line is really there. This patch must be backported as far as 2.0.
This commit is contained in:
parent
003df1cff9
commit
a7d6cf24fb
@ -64,11 +64,9 @@ struct htx_sl *http_get_stline(const struct htx *htx)
|
||||
{
|
||||
struct htx_blk *blk;
|
||||
|
||||
BUG_ON(htx->first == -1);
|
||||
blk = htx_get_first_blk(htx);
|
||||
if (!blk)
|
||||
if (!blk || (htx_get_blk_type(blk) != HTX_BLK_REQ_SL && htx_get_blk_type(blk) != HTX_BLK_RES_SL))
|
||||
return NULL;
|
||||
BUG_ON(htx_get_blk_type(blk) != HTX_BLK_REQ_SL && htx_get_blk_type(blk) != HTX_BLK_RES_SL);
|
||||
return htx_get_blk_ptr(htx, blk);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user