[S] Change in osmo-ttcn3-hacks[master]: HTTP_Adapter: add HOST field to header lines.
dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36503?usp=email ) Change subject: HTTP_Adapter: add HOST field to header lines. ...................................................................... HTTP_Adapter: add HOST field to header lines. In HTTP 1.1 (this is what the HTTP_Adapter uses), the Host header field is mandatory, see also: RFC 2616, section 14.23. Related: SYS#6824 Change-Id: Id4b2220da4b2b5fbe74cdc2776cf66d6b34ddbcf --- M library/HTTP_Adapter.ttcn 1 file changed, 19 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/03/36503/1 diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn index a957fdd..0885f05 100644 --- a/library/HTTP_Adapter.ttcn +++ b/library/HTTP_Adapter.ttcn @@ -37,7 +37,8 @@ } template (value) Close ts_HTTP_Close := { client_id := omit }; -template (value) HeaderLines ts_HTTP_Header(charstring body) := { +template (value) HeaderLines ts_HTTP_Header(charstring body, charstring host) := { + { header_name := "Host", header_value := host }, { header_name := "Content-Type", header_value := "application/json" }, { header_name := "Content-Length", header_value := int2str(lengthof(body)) } } @@ -45,14 +46,15 @@ template (value) HTTPMessage ts_HTTP_Req(charstring url, charstring method := "GET", charstring body := "", - integer v_maj := 1, integer v_min := 1) := { + integer v_maj := 1, integer v_min := 1, + charstring host) := { request := { client_id := omit, method := method, uri := url, version_major := v_maj, version_minor := v_min, - header := ts_HTTP_Header(body), + header := valueof(ts_HTTP_Header(body, host)), body := body } } @@ -75,7 +77,7 @@ runs on http_CT { HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port)); HTTP.receive(Connect_result:?); - HTTP.send(ts_HTTP_Req(url, method, body)); + HTTP.send(ts_HTTP_Req(url, method, body, host := g_http_host & ":" & int2str(g_http_port))); } function f_http_rx_response(template HTTPMessage exp := tr_HTTP_Resp2xx, float tout := 2.0) -- To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/36503?usp=email To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: osmo-ttcn3-hacks Gerrit-Branch: master Gerrit-Change-Id: Id4b2220da4b2b5fbe74cdc2776cf66d6b34ddbcf Gerrit-Change-Number: 36503 Gerrit-PatchSet: 1 Gerrit-Owner: dexter <pmaier@sysmocom.de> Gerrit-MessageType: newchange
participants (1)
-
dexter