Server IP : 85.214.239.14 / Your IP : 18.118.93.61 Web Server : Apache/2.4.62 (Debian) System : Linux h2886529.stratoserver.net 4.9.0 #1 SMP Tue Jan 9 19:45:01 MSK 2024 x86_64 User : www-data ( 33) PHP Version : 7.4.18 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare, MySQL : OFF | cURL : OFF | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : OFF Directory : /lib/x86_64-linux-gnu/perl5/5.36/XML/Parser/ |
Upload File : |
# LWPExternEnt.pl # # Copyright (c) 2000 Clark Cooper # All rights reserved. # # This program is free software; you can redistribute it and/or # modify it under the same terms as Perl itself. package XML::Parser; use URI; use URI::file; use LWP::UserAgent; ## ## Note that this external entity handler reads the entire entity into ## memory, so it will choke on huge ones. It would be really nice if ## LWP::UserAgent optionally returned us an IO::Handle. ## sub lwp_ext_ent_handler { my ($xp, $base, $sys) = @_; # We don't use public id my $uri; if (defined $base) { # Base may have been set by parsefile, which is agnostic about # whether its a file or URI. my $base_uri = new URI($base); unless (defined $base_uri->scheme) { $base_uri = URI->new_abs($base_uri, URI::file->cwd); } $uri = URI->new_abs($sys, $base_uri); } else { $uri = new URI($sys); unless (defined $uri->scheme) { $uri = URI->new_abs($uri, URI::file->cwd); } } my $ua = $xp->{_lwpagent}; unless (defined $ua) { $ua = $xp->{_lwpagent} = new LWP::UserAgent(); $ua->env_proxy(); } my $req = new HTTP::Request('GET', $uri); my $res = $ua->request($req); if ($res->is_error) { $xp->{ErrorMessage} .= "\n" . $res->status_line . " $uri"; return undef; } $xp->{_BaseStack} ||= []; push(@{$xp->{_BaseStack}}, $base); $xp->base($uri); return $res->content; } # End lwp_ext_ent_handler sub lwp_ext_ent_cleanup { my ($xp) = @_; $xp->base(pop(@{$xp->{_BaseStack}})); } # End lwp_ext_ent_cleanup 1;