You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
we have a similar issue with Curl header being lost (#365).
The issue come from using "curl_copy_handle".
If i'm not mistaken, the problem come from the injectDistributedTracingHeaders in (src/DDTrace/Integrations/Curl/CurlIntegration.php). When we call exec on the new handle, the method try to retrieve the headers that were set on it (ArrayKVStore::getForResource($ch, Format::CURL_HTTP_HEADERS, []);) but since those were copied by PHP between the 2 handle and not set on the new handle, it returns nothing.
Here's a quick example that trigger the issue for me.
By Commenting the 'require' of the dd_init.php script you see the header changing in the 2nd curl call.
Currently, we deactivated Distributed Tracing and it 'fixes' the issue as the header are not overwritten then.
<?php
require '/opt/datadog-php/dd-trace-sources/bridge/dd_init.php';
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "http://www.example.com/");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($ch, CURLINFO_HEADER_OUT, true);
$result = curl_exec($ch);
$info = curl_getinfo($ch);
var_dump($info['request_header']);
// Before closing copy handle
$ch2 = curl_copy_handle($ch);
curl_close($ch);
//Do a request on the new handle without setting the headers
curl_setopt($ch2, CURLINFO_HEADER_OUT, true);
$result = curl_exec($ch2);
$info = curl_getinfo($ch2);
var_dump($info['request_header']);
curl_close($ch2);
The text was updated successfully, but these errors were encountered:
We are able to reproduce this issue on our end and are working on a fix. We will update this thread as soon as we are able to provide a patch. Until that time, you can temporarily disable the cURL integration by setting the following environment variable: DD_INTEGRATIONS_DISABLED=curl.
Hi,
we have a similar issue with Curl header being lost (#365).
The issue come from using "curl_copy_handle".
If i'm not mistaken, the problem come from the injectDistributedTracingHeaders in (src/DDTrace/Integrations/Curl/CurlIntegration.php). When we call exec on the new handle, the method try to retrieve the headers that were set on it (ArrayKVStore::getForResource($ch, Format::CURL_HTTP_HEADERS, []);) but since those were copied by PHP between the 2 handle and not set on the new handle, it returns nothing.
Here's a quick example that trigger the issue for me.
By Commenting the 'require' of the dd_init.php script you see the header changing in the 2nd curl call.
Currently, we deactivated Distributed Tracing and it 'fixes' the issue as the header are not overwritten then.
The text was updated successfully, but these errors were encountered: