Giter VIP home page Giter VIP logo

Comments (7)

ursulnegrul avatar ursulnegrul commented on July 19, 2024 2

Since multipart requests don't work with "php://input", I had to rebuild the request for the guzzle multipart option, example:


$gzOptions = [
	'verify'  => false,
	'cookies' => true
];

#PATCH for multipart requests.
if ( $_SERVER['REQUEST_METHOD'] === 'POST' && stristr( $_SERVER['CONTENT_TYPE'], 'multipart' ) ) {
	unset( $_SERVER['CONTENT_TYPE'] );
	//Run Request Factory AFTER, not before.
	$multipart    = urldecode( http_build_query( $_POST ) );
	$multipartArr = strstr( $multipart, '&' ) ? explode( '&', $multipart ) : [ $multipart ];
	foreach ( $multipartArr as $pair ) {
		$pairArr = strstr( $pair, '=' ) ? explode( '=', $pair ) : [ $pair ];

		$gzOptions['multipart'][] = [ 'name' => $pairArr[0], 'contents' => isset( $pairArr[1] ) ? $pairArr[1] : '' ];
	}
}

$guzzle = new GuzzleHttp\Client( $gzOptions );

// Create a PSR7 request based on the current browser request.
$request = ServerRequestFactory::fromGlobals();

If this can be simplified then I would love to hear in case I'm missing something.

from php-proxy.

jenssegers avatar jenssegers commented on July 19, 2024

Can you try the latest version and report back? I will close this until then.

from php-proxy.

birdspider avatar birdspider commented on July 19, 2024

I see the codebase changed quite a bit. I wrote a workaround back when I reported the issue. I'm sorry I can't test this as-is.

But it should be easy to do a html from with multipart/form-data and check if $_POST is filled on the behind-proxy-side.

Anyway thank you for looking into it.

from php-proxy.

jenssegers avatar jenssegers commented on July 19, 2024

The current code now uses Symfony request/response objects and Guzzle to send and receive the requests. It makes it more flexible and easier to use for developers.

from php-proxy.

sochbonz avatar sochbonz commented on July 19, 2024

l am using the basic example code. POST url encoded or JSON is not sent with the redirect. Is there something l am missing.

from php-proxy.

ursulnegrul avatar ursulnegrul commented on July 19, 2024

I have the same problem, the multipart post content is not transmitted to the proxified target, i'm not sure where the posted data gets lost as I debugged and reached the guzzle client stream_for php//input
Is a multipart/form-data; boundary=----WebKitFormBoundaryblabla..
Tried using the guzzle5 branch with symphony, but no option for stackhandlers with guzzle v5 .

from php-proxy.

kevinp1005 avatar kevinp1005 commented on July 19, 2024

Any updates on this?

from php-proxy.

Related Issues (20)

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.