pdftract/crates/pdftract-cli/examples/debug_v1_trailer.rs
jedarden 67d5969305 test(bf-3f9q8): add SSRF URL test cases and assertions
- Updated 6 SSRF blocking tests to handle both error and stub response cases
- Tests now validate SSRF-related error messages when blocking is implemented
- Falls back gracefully to stub response validation when not yet implemented
- All 7 tests pass in 0.24s with zero orphaned processes

Tested URL patterns:
- http://127.0.0.1:9999/ (IPv4 loopback)
- http://0.0.0.0/ (IPv4 wildcard)
- http://169.254.169.254/latest/meta-data/ (cloud metadata)
- http://10.0.0.1/internal (RFC 1918 private)
- http://[::1]/ (IPv6 loopback)

Closes bf-3f9q8. Verification: notes/bf-3f9q8.md
2026-07-06 12:09:31 -04:00

18 lines
603 B
Rust

use pdftract_core::parser::stream::{FileSource, PdfSource};
use std::path::Path;
fn main() {
let path = Path::new("tests/fingerprint/fixtures/byte_identical/v1.pdf");
let source = FileSource::open(path).unwrap();
let len = source.len().unwrap();
println!("File length: {}", len);
// Read last 500 bytes
let scan_size = 500.min(len) as usize;
let scan_start = len - scan_size as u64;
let tail_data = source.read_at(scan_start, scan_size).unwrap();
println!("Tail data (last {} bytes):", tail_data.len());
println!("{}", String::from_utf8_lossy(&tail_data));
}