0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

馬鹿の一つ覚え: CGI

Last updated at Posted at 2018-03-04

入力フォームで入力文字数を制限

<input type="text" name="data" size="64" maxlength="4096" value="data">

この例では4096文字までに制限。

Perlでデータ量制限

use CGI;
$CGI::POST_MAX = 1024 * 1024;
my $query = new CGI;

この例では1 MBに制限。

Pythonでデータ量制限

import cgi
cgi.maxlen = 1024 * 1024
data = cgi.FieldStorage()

この例では1 MBに制限。

/tmp/に書き込めない

CentOS 7に組み込まれていたhttpdでCGIを作っていたら、/tmp/に書き込めなかった。
何らかの設定でそうなっているらしい。
原因を探れば設定を変更することは可能だろうが、データの書き出しに/tmp/は使わなければいい。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?