You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by cascade <ca...@126.com> on 2007/10/23 06:19:53 UTC

Mina 1.1.3 httpserver example's post method problem

i used Mina 1.1.3 to do one httpserver project.
if i used html form "POST" method to post data to the Mina server ,it works
well.
but if i used php's CURL's "POST" method ,it never success,it hang there.

before when i used CURL's "GET" method ,it failed as post method. 
i search the forum and modify the httpserver example's segment 
----------------------------------------------------------------------------
 if (response != null) {
            session.write(response).join();
        }
----------------------------------------------------------------------------
to
----------------------------------------------------------------------------
if (response != null) {
		            session.write(response).addListener(IoFutureListener.CLOSE);
		        }

----------------------------------------------------------------------------
then it works.

but the "POST"method use php CURL never work.

I think maybe something have problem.
any suggestion?

belowing is my php curl example:

testcurlpost.php
--------------------------------------------------
function testCurlPost()
{
	 
	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, "http://localhost:8090");
	curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
	curl_setopt($ch, CURLOPT_TIMEOUT, 60);
	curl_setopt($ch, CURLOPT_POST, 1);
                $fields = array(
		"user" => "user000",
		"pwd" => "pwd000",
	curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
	
	$result=curl_exec($ch);
	curl_close ($ch);
	return $result;
}
echo testCurlPost();
-- 
View this message in context: http://www.nabble.com/Mina-1.1.3-httpserver-example%27s-post--method-problem-tf4675118s16868.html#a13357202
Sent from the Apache MINA Support Forum mailing list archive at Nabble.com.