Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
hushicai committed Nov 5, 2014
1 parent 3010c33 commit 3614e18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion demo/upload/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
<title>upload</title>
</head>
<body>
<form action="./index.php" method="post" enctype="multipart/form-data">
<form action="./index.php" method="post" enctype="multipart/form-data" target="hidden">
<input type="file" name="avatar">
<input type="submit" value="submit">
</form>
<iframe src="about:blank" name="hidden" style="display: none"></iframe>
</body>
</html>
10 changes: 5 additions & 5 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,17 +131,17 @@ exports = module.exports = function(options) {
// 如果上一个中间件已经接受了post数据,即有类似这样`req.on('data', function(chunk) {})`的逻辑
// req.readable会被置为false
// 在这里pipe可能会导致child.stdin一直在等待数据输入,phpcgi无法响应。
// 怎么处理readable为false的情况呢?
if (req.readable) {
req.pipe(child.stdin);
}
else if (red.body) {
else if (req.body) {
// express body parser
req.end(req.body);
// how to do?
// child.stdin.end(JSON.stringify(req.body));
}
else if (red.bodyBuffer) {
else if (req.bodyBuffer) {
// edp
req.end(req.bodyBuffer);
child.stdin.end(req.bodyBuffer);
}

// buffer data
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-phpcgi",
"version": "0.1.9",
"version": "0.2.0",
"description": "Execute php in node with php-cgi",
"main": "main.js",
"directories": {
Expand Down

0 comments on commit 3614e18

Please sign in to comment.