Apache2によって提供されるCGI環境では、Cで記述されたcgi実行可能ファイルを使用します
cgi.c:
#define MY_SIZE 102400
#define MY_SIZE_OUT (2 + (MY_SIZE * 2))
int main()
{
char buf[SIZE + 2];
int n;
if (write(1, "Content-type: text/html\n\n", 25) == -1)
{
puts("An internal error occured, please report the bug #005");
goto EXIT;
}
if ((n = read(0, buf, MY_SIZE)) == -1)
{
puts("An internal error occured, please report the bug #004");
goto EXIT;
}
buf[n] = '\n';
buf[n + 1] = 0;
printf("Size of input = %i |--| |%s| max size = %i\n", n, buf, MY_SIZE);
EXIT:
return 1;
}
私のPOSTリクエストはAjaxコードで送信されます:
ajaxRequest.onreadystatechange = function(){
if(ajaxRequest.readyState == 4){
var text;
var exp;
text = ajaxRequest.responseText;
exp = new RegExp("([^ ]+)", "g");
text = text.replace(exp, "<a class='wd' onClick='man_wd(this);'>$1</a>");
document.getElementById("out").innerHTML = text;
}
}
document.getElementById("out").innerHTML = "Processing...";
ajaxRequest.open("POST", "cgi-bin/a.cgi", true);
ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
ajaxRequest.setRequestHeader("Content-length", 5 + document.forms['f_main'].ta_in.value.length);
ajaxRequest.setRequestHeader("Connection", "close");
ajaxRequest.send(getPrefix() + " " + document.forms['f_main'].ta_in.value);
私の問題は、MY_SIZE値が102400であっても、CGI実行可能文字が最大1060文字で読み取られるN文字を超える要求を送信する場合です。
php.iniに出くわしましたが、POSTサイズの制限は8Mbです。
誰かアイデアがありますか?