From: Nicolas Boisselier Date: Tue, 1 Mar 2016 15:11:46 +0000 (+0000) Subject: URI::Escape X-Git-Url: https://git.nbdom.net/?a=commitdiff_plain;h=af88fcd4940ae59a0a23165bce33f3025d6d3640;p=nb.git URI::Escape --- diff --git a/bin/dbq b/bin/dbq index 7d3dc121..7d7409a6 100755 --- a/bin/dbq +++ b/bin/dbq @@ -2,6 +2,7 @@ use strict; use warnings; use Encode; +use URI::Escape; use NB::Functions qw/html2txt/; ################################################################################# # @@ -86,12 +87,16 @@ for my $o (@CURL_OPT) { # # Build command # +my $url = ($ENV{$UC_NAME.'_URL'} ? $ENV{$UC_NAME.'_URL'} : 'http://127.0.0.1'); my @cmd = ( #'echo', - 'curl', '-s', ($ENV{$UC_NAME.'_URL'} ? $ENV{$UC_NAME.'_URL'} : 'http://127.0.0.1'), - '-H', 'Host: '.($ENV{$UC_NAME.'_HOST'} ? $ENV{$UC_NAME.'_HOST'} : 'rent'), + 'curl', $url, ); +if ($url =~ m,^\w+://[\d\.]+/?,) { + push (@cmd,'-H', 'Host: '.($ENV{$UC_NAME.'_HOST'} ? $ENV{$UC_NAME.'_HOST'} : 'rent')); +} + # # Add args # @@ -239,6 +244,7 @@ sub csv2txt { } sub esc { + return URI::Escape::uri_escape($_[0]); local $_=shift;s/([^A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg; return $_; };