Git Product home page Git Product logo

cuzzle's People

Contributors

cirpo avatar csarrazi avatar lazyants avatar lyrixx avatar nikita2206 avatar odino avatar sergeax avatar sobit avatar tchoulom avatar tobion avatar vaidasm avatar xkobal avatar zainengineer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cuzzle's Issues

Logger shows only the first file in a request with more than one file

Hi,
I'm doing a request with one text field (named JSON) and two files (named file and icon).

This is the log output:

curl 'http://test.local/app_dev.php/test/post' \   -A 'Guzzle/5.3.0 curl/7.22.0 PHP/5.5.27-1+deb.sury.org~precise+1' \   -H 'Content-Type: multipart/form-data' -X POST \   -d '--55af920568ab9 Content-Disposition: form-data; name="JSON"  {"title":"Title","filename":"video.mp4","startdate":"22-07-2015","starttime":"02:49","enddate":"31-12-2016","endtime":"23:59","https":"yes"} --55af920568ab9 Content-Disposition: form-data; name="icon"; filename="fok_original.jpg" Content-Type: image/jpeg  '

I added a var_dump on controller and $request->request->all() shows me the JSON field and $request->files has two elements, file and icon.

Anyone can replicate this?

Thank you.

support PUT Guzzle requests

I think it's closely related to the other two issues: #1 and #9.

When I send Guzzle request with PUT method with the binary data, I get the following exception.

FatalErrorException in CurlFormatter.php line 135:
Error: escapeshellarg(): Input string contains NULL bytes

FYI, I leave a part of the stack trace. I don't think you need all of them.

in CurlFormatter.php line 135
at escapeshellarg() in CurlFormatter.php line 135
at CurlFormatter->extractBodyArgument() in CurlFormatter.php line 218
at CurlFormatter->extractArguments() in CurlFormatter.php line 54
at CurlFormatter->format() in GuzzleCollector.php line 99
at GuzzleCollector->collect() in Profiler.php line 223
...

I already saw the pull request #17. But I don't think it's a good idea to show binary data. Instead, I suggest you to put them into a file and give curl argument with -d @[filename] if the file is binary.

[Guzzle 6] Exception : Query and fragment must be a string

In CurlFormatter::extractUrlArgument, calling withFragment with null throws an exception because the PSR-7 Uri implementation of Guzzle immediatly calls filterQueryAndFragment which checks if the fragment is a string :

// CurlFormatter.php

$uri = $request->getUri();
$uri = $uri->withFragment(null); /// <----------------

$this->addCommandPart(escapeshellarg((string)$uri));
// Uri.php

public function withFragment($fragment)
{
    $fragment = $this->filterQueryAndFragment($fragment); /// <----------------

    if ($this->fragment === $fragment) {
        return $this;
    }

    $new = clone $this;
    $new->fragment = $fragment;
    return $new;
}

private function filterQueryAndFragment($str)
{
    if (!is_string($str)) { /// <----------------
        throw new \InvalidArgumentException('Query and fragment must be a string');
    }

    return preg_replace_callback(
        '/(?:[^' . self::$charUnreserved . self::$charSubDelims . '%:@\/\?]++|%(?![A-Fa-f0-9]{2}))/',
        [$this, 'rawurlencodeMatchZero'],
        $str
    );
}

Should an empty string be passed instead ? Or not be called at all (depending if the string representation of the Uri holds the fragment, as it's the case for Guzzle) ?

Brice

Failed to format large request body

I've got this error after upload big file (~10MB video) via Guzzle:

FatalErrorException in CurlFormatter.php line 137:
Error: escapeshellarg(): Argument exceeds the allowed length of 2097152 bytes

Traceback:

1. in CurlFormatter.php line 137
2. at escapeshellarg() in CurlFormatter.php line 137
3. at CurlFormatter->extractBodyArgument() in CurlFormatter.php line 220
4. at CurlFormatter->extractArguments() in CurlFormatter.php line 54
5. at CurlFormatter->format() in GuzzleCollector.php line 100
6. at GuzzleCollector->collect() in Profiler.php line 218
7. at Profiler->collect() in ProfilerListener.php line 128
8. at ProfilerListener->onKernelResponse() in WrappedListener.php line 61

Does not extract headers if passed as options to Guzzle

Cuzzle formats correctly headers when they are passed to the Request object, but not when passed to the array options of Guzzle. These two pieces of code should return the same value, but they don't.

<?php

use Namshi\Cuzzle\Formatter\CurlFormatter;
use GuzzleHttp\Psr7\Request;

require_once(__DIR__.'/vendor/autoload.php');

// curl 'http://some-url.com/path' -H 'Some-Header: lorem'
echo (new CurlFormatter())->format(
    new Request('get', 'http://some-url.com/path', ['Some-Header' => 'lorem']),
    []
);

// curl 'http://some-url.com/path'
echo (new CurlFormatter())->format(
    new Request('get', 'http://some-url.com/path'),
    ['headers' => ['Some-Header' => 'lorem']]
);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.