<p>laforge <strong>submitted</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23021">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  laforge: Looks good to me, approved
  pespin: Looks good to me, but someone else must approve
  Jenkins Builder: Verified

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">HTTP_Adapter: split into f_http_tx_request() / f_http_rx_response()<br><br>There are some use cases in which we don't want a blocking wait for the<br>full HTTP request to complete.  Let's split it up in two parts, and<br>make the existing f_http_transact() a wrapper around them.<br><br>Also, enable the generation of the Connect_result primitive to detect<br>connection failures.<br><br>Change-Id: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400<br>---<br>M library/HTTP_Adapter.ttcn<br>M remsim/REMSIM_Tests.default<br>2 files changed, 18 insertions(+), 9 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/library/HTTP_Adapter.ttcn b/library/HTTP_Adapter.ttcn</span><br><span>index 03de1f3..a957fdd 100644</span><br><span>--- a/library/HTTP_Adapter.ttcn</span><br><span>+++ b/library/HTTP_Adapter.ttcn</span><br><span>@@ -71,17 +71,17 @@</span><br><span> </span><br><span> template HTTPMessage tr_HTTP_Resp2xx := tr_HTTP_Resp((200..299));</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-/* run a HTTP request and return the response */</span><br><span style="color: hsl(0, 100%, 40%);">-function f_http_transact(charstring url, charstring method := "GET",</span><br><span style="color: hsl(0, 100%, 40%);">-                    charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,</span><br><span style="color: hsl(0, 100%, 40%);">-                   float tout := 2.0)</span><br><span style="color: hsl(120, 100%, 40%);">+function f_http_tx_request(charstring url, charstring method := "GET", charstring body := "")</span><br><span style="color: hsl(120, 100%, 40%);">+runs on http_CT {</span><br><span style="color: hsl(120, 100%, 40%);">+     HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));</span><br><span style="color: hsl(120, 100%, 40%);">+ HTTP.receive(Connect_result:?);</span><br><span style="color: hsl(120, 100%, 40%);">+       HTTP.send(ts_HTTP_Req(url, method, body));</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+function f_http_rx_response(template HTTPMessage exp := tr_HTTP_Resp2xx, float tout := 2.0)</span><br><span> runs on http_CT return HTTPMessage {</span><br><span>         var HTTPMessage resp;</span><br><span>        timer T := tout;</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">-        HTTP.send(ts_HTTP_Connect(g_http_host, g_http_port));</span><br><span style="color: hsl(0, 100%, 40%);">-   //HTTP.receive(Connect_result:?);</span><br><span style="color: hsl(0, 100%, 40%);">-       HTTP.send(ts_HTTP_Req(url, method, body));</span><br><span>   T.start;</span><br><span>     alt {</span><br><span>        [] HTTP.receive(exp) -> value resp {</span><br><span>@@ -99,4 +99,13 @@</span><br><span>         return resp;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* run a HTTP request and return the response */</span><br><span style="color: hsl(120, 100%, 40%);">+function f_http_transact(charstring url, charstring method := "GET",</span><br><span style="color: hsl(120, 100%, 40%);">+                        charstring body := "", template HTTPMessage exp := tr_HTTP_Resp2xx,</span><br><span style="color: hsl(120, 100%, 40%);">+                         float tout := 2.0)</span><br><span style="color: hsl(120, 100%, 40%);">+runs on http_CT return HTTPMessage {</span><br><span style="color: hsl(120, 100%, 40%);">+     f_http_tx_request(url, method, body);</span><br><span style="color: hsl(120, 100%, 40%);">+ return f_http_rx_response(exp, tout);</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> }</span><br><span>diff --git a/remsim/REMSIM_Tests.default b/remsim/REMSIM_Tests.default</span><br><span>index 7a41555..3059a8d 100644</span><br><span>--- a/remsim/REMSIM_Tests.default</span><br><span>+++ b/remsim/REMSIM_Tests.default</span><br><span>@@ -1,3 +1,3 @@</span><br><span> [TESTPORT_PARAMETERS]</span><br><span> system.HTTP.http_debugging := "yes"</span><br><span style="color: hsl(0, 100%, 40%);">-system.HTTP.use_notification_ASPs := "no"</span><br><span style="color: hsl(120, 100%, 40%);">+system.HTTP.use_notification_ASPs := "yes"</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23021">change 23021</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/23021"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: osmo-ttcn3-hacks </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I5c7575c0b58c3606d25d8f8cfccd47cfb7a8c400 </div>
<div style="display:none"> Gerrit-Change-Number: 23021 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins Builder </div>
<div style="display:none"> Gerrit-Reviewer: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: pespin <pespin@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>