<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Hello,</p>
<p>apparently that feature was not migrated in http_client, being
overlooked when the variant from utils modules was removed.</p>
<p>I just pushed a patch for it in master branch. If you can test it
and report if all works fine, then I will consider backporting it
to 5.0, given it is like a regression.</p>
<p>Otherwise, I haven't seen an option to provide custom headers to
functions in http_client module, but http_async_client has this
option, and I expect (not checked the code) that together with
disabling suspend option should be like a synchronous query.</p>
<p>Cheers,<br>
Daniel<br>
</p>
<br>
<div class="moz-cite-prefix">On 29.06.17 20:47, Joel Serrano wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAMtXxQnZ6QnEDWBmCXSCnJPcCTW4mn3BqFMS_WDkMb8Qp9KL4Q@mail.gmail.com">
<div dir="ltr">Hi all,
<div><br>
</div>
<div>Is there a way to add extra headers with
http_client_query() from http_client module?</div>
<div><br>
</div>
<div>
<div>In current http_query() from utils module, according to
the doc, you can add a custom header:</div>
<div><br>
</div>
<div>
<div><i>4. Functions</i></div>
<div><i>4.1. http_query(url, [post-data], [header-data],
result)<br>
</i></div>
<div><i>...</i></div>
<div><i>If you want to add additional headers to the
request, you have to define the “header”-data, that
should be submitted in that request as the third
parameter. If this parameter is empty, it is not set.<br>
</i></div>
<div><i>...</i></div>
</div>
</div>
<div><br>
</div>
<div>and I have that working with the following:</div>
<div><br>
</div>
<div><font face="monospace, monospace">http_query("<a
href="https://example.com/api" moz-do-not-send="true">https://example.com/api</a>",
"param1=value1¶m2=value2", "Cookie:
apikey=super_secret_api_key", "$var(call_info)");</font><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div>The problem is that http_query() is removed in Kamailio v5,
and the http_client_query() only has the ability to add
specifically the content-type header:</div>
<div><br>
</div>
<div>
<div><i>4. Functions</i></div>
<div><i>4.1. http_connect(connection, url, [content_type,
data,] result)<br>
</i></div>
<div><i>...</i></div>
<div><i>content_type - Used only when posting data with HTTP
POST. An Internet Media type, like "application/json" or
"text/plain". Will be added to the HTTP request as a
header.<br>
</i></div>
<div><i>...</i></div>
</div>
<div><br>
</div>
<div><br>
</div>
<div>Is there another way to add a custom header to a http
request with the http_client module?</div>
<div><br>
</div>
<div>Any workarounds for this?</div>
<div><br>
</div>
<div><br>
</div>
<div>Thanks, </div>
<div>Joel.</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<br>
<pre class="moz-signature" cols="72">--
Daniel-Constantin Mierla
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Kamailio Advanced Training - <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
Kamailio World Conference - <a class="moz-txt-link-abbreviated" href="http://www.kamailioworld.com">www.kamailioworld.com</a></pre>
</body>
</html>