diff options
author | Eric Wong <e@80x24.org> | 2019-09-12 08:34:20 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2019-09-14 09:24:23 +0000 |
commit | e5631087d3862823d0d4854a8dfc1258f91cb115 (patch) | |
tree | cbb6b7bf2c117fc8550f20c12116582933351131 /lib/PublicInbox/HTTP.pm | |
parent | bb20bc29a831d8f84613d48af729ffaede9d43e2 (diff) | |
download | public-inbox-e5631087d3862823d0d4854a8dfc1258f91cb115.tar.gz |
Although we always unlink temporary files, give them a meaningful name so that we can we can still make sense of the pre-unlink name when using lsof(8) or similar tools on Linux.
Diffstat (limited to 'lib/PublicInbox/HTTP.pm')
-rw-r--r-- | lib/PublicInbox/HTTP.pm | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/HTTP.pm b/lib/PublicInbox/HTTP.pm index 19b57d59..b43ef870 100644 --- a/lib/PublicInbox/HTTP.pm +++ b/lib/PublicInbox/HTTP.pm @@ -21,6 +21,7 @@ use IO::Handle; require PublicInbox::EvCleanup; use PublicInbox::DS qw(msg_more); use PublicInbox::Syscall qw(EPOLLIN EPOLLONESHOT); +use PublicInbox::Tmpfile; use constant { CHUNK_START => -1, # [a-f0-9]+\r\n CHUNK_END => -2, # \r\n @@ -325,8 +326,9 @@ sub response_write { } sub input_tmpfile ($) { - open($_[0], '+>', undef); - $_[0]->autoflush(1); + my $input = tmpfile('http.input', $_[0]->{sock}) or return; + $input->autoflush(1); + $input; } sub input_prepare { @@ -338,10 +340,10 @@ sub input_prepare { quit($self, 413); return; } - input_tmpfile($input); + $input = input_tmpfile($self); } elsif (env_chunked($env)) { $len = CHUNK_START; - input_tmpfile($input); + $input = input_tmpfile($self); } else { $input = $null_io; } |