git: 2eda074584 - main - ports.cgi: enforce limit of pkg list results
Wolfram Schneider <[email protected]>
| Newsgroups | gmane.os.freebsd.devel.cvs.doc |
|---|---|
| Message-ID | <[email protected]> |
The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/doc/commit/?id=2eda0745848922280c67d860b6d08f8f3e179e2f commit 2eda0745848922280c67d860b6d08f8f3e179e2f Author: Wolfram Schneider <[email protected]> AuthorDate: 2026-02-02 08:39:09 +0000 Commit: Wolfram Schneider <[email protected]> CommitDate: 2026-02-02 08:39:09 +0000 ports.cgi: enforce limit of pkg list results --- website/content/en/cgi/ports.cgi | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/website/content/en/cgi/ports.cgi b/website/content/en/cgi/ports.cgi index 9c79aa96ca..cc51cf2281 100755 --- a/website/content/en/cgi/ports.cgi +++ b/website/content/en/cgi/ports.cgi @@ -108,6 +108,7 @@ EOF # No unlimited result set. A HTML page with 1000 results can be 10MB big. my $max_hits = 1000; my $max_hits_default = 250; +my $max_hits_pkg = 400; my $max; my $debug = 1; @@ -427,7 +428,6 @@ sub package_links { } if ( $. == 1 ) { - print qq[<h2>$perl->{"name"}: $perl->{"comment"}</h2>\n]; print qq[homepage: <a href="], $perl->{"www"}, @@ -477,6 +477,7 @@ qq{ <th onclick="sort_table(2)" title="click to sort asc/desc by build time">Bui && index( $time, $filter ) < 0; } + next if $counter >= $max; $counter++; my $info = @@ -665,8 +666,10 @@ sub check_input { $max = int($max); if ( $max <= 0 || $max > $max_hits ) { - warn "reset max=$max to $max_hits_default\n"; - $max = $max_hits_default; + my $old_max = $max; + $max = $enable_packages_link + && $stype eq 'pkg' ? $max_hits_pkg : $max_hits_default; + warn "reset max=$old_max to $max\n"; } } @@ -774,7 +777,8 @@ $stype = $form{'stype'} // ""; $sourceid = $form{'sourceid'} // ""; $pkg_filter = $form{'pkg_filter'} // ""; $script_name = &env('SCRIPT_NAME'); -$max = $form{'max'} // $max_hits_default; +$max = $form{'max'} // ( $enable_packages_link + && $stype eq 'pkg' ? $max_hits_pkg : $max_hits_default ); if ( $path_info eq "/source" ) { print "Content-type: text/plain\n\n";