testillano / h2agent

C++ HTTP/2 Mock Service which enables mocking HTTP/2 applications (also HTTP/1 supported).
Other
10 stars 0 forks source link

Wrong request generation in udp-server-h2client #103

Closed testillano closed 1 year ago

testillano commented 1 year ago

Describe the bug The udp-server-h2client is generatig outgoing traffic with a lambda where everything is passed by reference. But, although most of the members are static (fixed values): method, headers, etc., the UDP DATAGRAM DOES NOT !

To Reproduce 1) Launch h2agent with this provision: { "requestMethod": "POST", "responseBody": { "servingNetwork": { "mcc": "460", "mnc": "01" } }, "responseCode": 200, "responseHeaders": { "content-type": "application/json" } }, { "requestMethod": "POST", "requestUri": "/policy/notification/unexpected", "responseCode": 404 }

2) Launch UDP server ni this way: docker run --rm -it -v socketVolume:/tmp --network=host --entrypoint /opt/udp-server-h2client ghcr.io/testillano/h2agent:bad -k /tmp/udp.sock ${OPTS[*]} --uri http://0.0.0.0:8000/@{udp} -e 10000 --method POST

3) Launch random load: docker run --rm -it -v socketVolume:/tmp --entrypoint /opt/udp-client ghcr.io/testillano/h2agent:latest -k /tmp/udp.sock -e 10000 --eps 10000 --pattern "@{seq}" --pattern "policy/notification/unexpected"

Expected behavior This error trace appears: udp-server-h2client: [Error]|/code/build/http2comm/src/Http2Client.cpp:184(operator())|Request submit error, closing connection ...

This is because corruption in request URI.

The solution is: pass by copy, not by reference.