Skip to content

Commit 85745aa

Browse files
authored
[USM] HTTP2: Use SetStatusCode for static table (#41855)
## What does this PR do? Uses SetStatusCode function for handling HTTP2 static table status codes. ## Motivation Ensures consistent status code handling for HTTP2 static table entries. ## Description of the changes - Updated HTTP2 static table code to use SetStatusCode - Ensures proper status code setting for HTTP2 responses - Improves consistency in HTTP2 status code handling ## Additional Notes Part of USMON-658 work. --- 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent c5451be commit 85745aa

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

pkg/network/protocols/http2/model_linux.go

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -263,29 +263,33 @@ func (ew *EventWrapper) Method() http.Method {
263263
// Otherwise, f the status code is huffman encoded, then we decode it and convert it from string to int.
264264
// Otherwise, we convert the status code from byte array to int.
265265
func (ew *EventWrapper) StatusCode() uint16 {
266+
if ew.statusCodeSet {
267+
return ew.statusCode
268+
}
269+
266270
if ew.Stream.Status_code.Static_table_entry != 0 {
271+
statusCode := uint16(0)
267272
switch ew.Stream.Status_code.Static_table_entry {
268273
case K200Value:
269-
return 200
274+
statusCode = 200
270275
case K204Value:
271-
return 204
276+
statusCode = 204
272277
case K206Value:
273-
return 206
278+
statusCode = 206
274279
case K304Value:
275-
return 304
280+
statusCode = 304
276281
case K400Value:
277-
return 400
282+
statusCode = 400
278283
case K404Value:
279-
return 404
284+
statusCode = 404
280285
case K500Value:
281-
return 500
286+
statusCode = 500
282287
default:
283288
return 0
284289
}
285-
}
286290

287-
if ew.statusCodeSet {
288-
return ew.statusCode
291+
ew.SetStatusCode(statusCode)
292+
return statusCode
289293
}
290294

291295
if ew.Stream.Status_code.Is_huffman_encoded {

0 commit comments

Comments
 (0)