mirror of
https://github.com/weiss/ngx_http_upload.git
synced 2025-07-01 18:29:39 +00:00
Avoid calling $r->request_body repeatedly
This commit is contained in:
parent
18211ea7a0
commit
ee9c39ca6f
12
upload.pm
12
upload.pm
@ -133,13 +133,17 @@ sub handle_put_body {
|
|||||||
$r->log_error($!, "Cannot set binary mode for $file_path");
|
$r->log_error($!, "Cannot set binary mode for $file_path");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
if ($r->request_body) {
|
|
||||||
if (not syswrite($fh, $r->request_body)) {
|
my $request_body = $r->request_body;
|
||||||
|
my $request_body_file = $r->request_body_file;
|
||||||
|
|
||||||
|
if ($request_body) {
|
||||||
|
if (not syswrite($fh, $request_body)) {
|
||||||
$r->log_error($!, "Cannot write $file_path");
|
$r->log_error($!, "Cannot write $file_path");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
} elsif ($r->request_body_file) {
|
} elsif ($request_body_file) {
|
||||||
if (not move($r->request_body_file, $fh)) {
|
if (not move($request_body_file, $fh)) {
|
||||||
$r->log_error($!, "Cannot move data to $file_path");
|
$r->log_error($!, "Cannot move data to $file_path");
|
||||||
return HTTP_INTERNAL_SERVER_ERROR;
|
return HTTP_INTERNAL_SERVER_ERROR;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user