mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 06:03:28 +00:00
Move buffer size into a function
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -151,7 +151,8 @@ while(1) {
|
||||
if (open(FILE, ">$file")) {
|
||||
binmode(FILE);
|
||||
print STDERR "fastrpc: tcpwrite $file writing\n" if ($gconfig{'rpcdebug'});
|
||||
while(read(TRANS, $buf, $WebminCore::default_bufsize) > 0) {
|
||||
my $bs = &get_buffer_size();
|
||||
while(read(TRANS, $buf, $bs) > 0) {
|
||||
local $ok = (print FILE $buf);
|
||||
if (!$ok) {
|
||||
$err = "Write to $file failed : $!";
|
||||
@@ -180,7 +181,8 @@ while(1) {
|
||||
local ($data, $got);
|
||||
open(FILE, "<$arg->{'file'}");
|
||||
binmode(FILE);
|
||||
while(read(FILE, $got, $WebminCore::default_bufsize) > 0) {
|
||||
my $bs = &get_buffer_size();
|
||||
while(read(FILE, $got, $bs) > 0) {
|
||||
$data .= $got;
|
||||
}
|
||||
close(FILE);
|
||||
|
||||
@@ -28,7 +28,7 @@ use vars qw($module_index_name $number_to_month_map $month_to_number_map
|
||||
$umask_already $default_charset $licence_status $os_type
|
||||
$licence_message $script_name $loaded_theme_oo_library
|
||||
$done_web_lib_funcs $os_version $module_index_link
|
||||
$called_from_webmin_core $ipv6_module_error $default_bufsize);
|
||||
$called_from_webmin_core $ipv6_module_error);
|
||||
|
||||
=head2 read_file(file, &hash, [&order], [lowercase], [split-char])
|
||||
|
||||
@@ -635,7 +635,8 @@ my ($in, $out) = @_;
|
||||
$in = &callers_package($in);
|
||||
$out = &callers_package($out);
|
||||
my $buf;
|
||||
while(read($in, $buf, $default_bufsize) > 0) {
|
||||
my $bs = &get_buffer_size();
|
||||
while(read($in, $buf, $bs) > 0) {
|
||||
(print $out $buf) || return 0;
|
||||
}
|
||||
return 1;
|
||||
@@ -7122,7 +7123,8 @@ return &$main::remote_error_handler("Failed to transfer file : $error")
|
||||
if ($error);
|
||||
open(FILE, "<".$localfile) ||
|
||||
return &$main::remote_error_handler("Failed to open $localfile : $!");
|
||||
while(read(FILE, $got, $default_bufsize) > 0) {
|
||||
my $bs = &get_buffer_size();
|
||||
while(read(FILE, $got, $bs) > 0) {
|
||||
print TWRITE $got;
|
||||
}
|
||||
close(FILE);
|
||||
@@ -7160,7 +7162,8 @@ return &$main::remote_error_handler("Failed to transfer file : $error")
|
||||
my $got;
|
||||
open(FILE, ">$localfile") ||
|
||||
return &$main::remote_error_handler("Failed to open $localfile : $!");
|
||||
while(read(TREAD, $got, $default_bufsize) > 0) {
|
||||
my $bs = &get_buffer_size();
|
||||
while(read(TREAD, $got, $bs) > 0) {
|
||||
print FILE $got;
|
||||
}
|
||||
close(FILE);
|
||||
@@ -11526,6 +11529,18 @@ return &has_command("python3") || &has_command("python30") ||
|
||||
&has_command("python");
|
||||
}
|
||||
|
||||
=head2 get_buffer_size
|
||||
|
||||
Returns the buffer size for read/write operations
|
||||
|
||||
=cut
|
||||
sub get_buffer_size
|
||||
{
|
||||
my %miniserv;
|
||||
&get_miniserv_config(\%miniserv);
|
||||
return $miniserv{'bufsize'} || 32768;
|
||||
}
|
||||
|
||||
$done_web_lib_funcs = 1;
|
||||
|
||||
1;
|
||||
|
||||
@@ -9,7 +9,6 @@ $main::default_debug_log_size = 10*1024*1024;
|
||||
$webmin_feedback_address = "feedback\@webmin.com";
|
||||
$default_lang = "en";
|
||||
$default_charset = "UTF-8";
|
||||
$default_bufsize = 32768;
|
||||
|
||||
=head2 unique(string, ...)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user