Change in osmo-ttcn3-hacks[master]: HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Mon Feb 22 10:41:30 UTC 2021


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23021 )

Change subject: HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()
......................................................................

HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()

There are some use cases in which we don't want a blocking wait for the
full HTTP request to complete.  Let's split it up in two parts, and
make the existing f_http_transact() a wrapper around them.

Also, enable the generation of the Connect_result primitive to detect
connection failures.

Change-Id: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400
---
M library/HTTP_Adapter.ttcn
M remsim/REMSIM_Tests.default
2 files changed, 18 insertions(+), 9 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified



diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn
index 03de1f3..a957fdd 100644
--- a/library/HTTP_Adapter.ttcn
+++ b/library/HTTP_Adapter.ttcn
@@ -71,17 +71,17 @@
 
 template HTTPMessage tr_HTTP_Resp2xx := tr_HTTP_Resp((200..299));
 
-/* run a HTTP request and return the response */
-function f_http_transact(charstring url, charstring method := "GET",
-			 charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,
-			 float tout := 2.0)
+function f_http_tx_request(charstring url, charstring method := "GET", charstring body := "")
+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));
+}
+
+function f_http_rx_response(template HTTPMessage exp := tr_HTTP_Resp2xx, float tout := 2.0)
 runs on http_CT return HTTPMessage {
 	var HTTPMessage resp;
 	timer T := tout;
-
-	HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));
-	//HTTP.receive(Connect_result:?);
-	HTTP.send(ts_HTTP_Req(url, method, body));
 	T.start;
 	alt {
 	[] HTTP.receive(exp) -> value resp {
@@ -99,4 +99,13 @@
 	return resp;
 }
 
+/* run a HTTP request and return the response */
+function f_http_transact(charstring url, charstring method := "GET",
+			 charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,
+			 float tout := 2.0)
+runs on http_CT return HTTPMessage {
+	f_http_tx_request(url, method, body);
+	return f_http_rx_response(exp, tout);
+}
+
 }
diff --git a/remsim/REMSIM_Tests.default b/remsim/REMSIM_Tests.default
index 7a41555..3059a8d 100644
--- a/remsim/REMSIM_Tests.default
+++ b/remsim/REMSIM_Tests.default
@@ -1,3 +1,3 @@
 [TESTPORT_PARAMETERS]
 system.HTTP.http_debugging := "yes"
-system.HTTP.use_notification_ASPs := "no"
+system.HTTP.use_notification_ASPs := "yes"

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23021
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: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400
Gerrit-Change-Number: 23021
Gerrit-PatchSet: 2
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20210222/f98a48f2/attachment.htm>


More information about the gerrit-log mailing list