21         $command = sprintf(
'curl %s', escapeshellarg((
string) $request->
getUri()->withFragment(
'')));
 
   23             $command .= 
' --http1.0';
 
   25             $command .= 
' --http2';
 
   28         $method = strtoupper($request->
getMethod());
 
   29         if (
'HEAD' === $method) {
 
   30             $command .= 
' --head';
 
   31         } elseif (
'GET' !== $method) {
 
   32             $command .= 
' --request '.$method;
 
   35         $command .= $this->getHeadersAsCommandOptions($request);
 
   38         if ($body->getSize() > 0) {
 
   40             if ($body->getSize() > 8192) {
 
   41                 $data = 
'[too long stream omitted]';
 
   42             } elseif ($body->isSeekable()) {
 
   43                 $data = $body->__toString();
 
   45                 if (preg_match(
'/[\x00-\x1F\x7F]/', $data)) {
 
   46                     $data = 
'[binary stream omitted]';
 
   49                 $data = 
'[non-seekable stream omitted]';
 
   51             $escapedData = @escapeshellarg($data);
 
   52             if (empty($escapedData)) {
 
   53                 $escapedData = 
'We couldn\'t not escape the data properly';
 
   56             $command .= sprintf(
' --data %s', $escapedData);
 
   78         foreach ($request->
getHeaders() as $name => $values) {
 
   79             if (
'host' === strtolower($name) && $values[0] === $request->
getUri()->getHost()) {
 
   83             if (
'user-agent' === strtolower($name)) {
 
   84                 $command .= sprintf(
' -A %s', escapeshellarg($values[0]));
 
   89             $command .= sprintf(
' -H %s', escapeshellarg($name.
': '.$request->
getHeaderLine($name)));