<?xml version="1.0" encoding="windows-1252"?>
<node id="927698" title="No Host Option provided in Net::HTTP::methods, line 43" created="2011-09-24 21:46:10" updated="2011-09-24 21:46:10">
<type id="115">
perlquestion</type>
<author id="925765">
ted.byers</author>
<data>
<field name="doctext">
&lt;p&gt;The title is the error message I find in the apache error logs.&lt;/p&gt;
&lt;p&gt;What is especially odd is that there are two different cgi scripts that do basically the same thing, but one works and the other gives this error.&lt;/p&gt;
&lt;p&gt;You can even check out the behaviour of the two scripts at these two URLS:&lt;/p&gt;
&lt;code&gt; 
http://74.15.160.240:8080/cgi-bin/Aresults.cgi
http://74.15.160.240:8080/cgi-bin/calculator.cgi
&lt;/code&gt; 
&lt;p&gt;The following code producs the error in the title&lt;/p&gt;
&lt;code&gt;
sub print_response {
    unless ($query-&gt;param) {
      print "&lt;b&gt;Results&lt;/b&gt;";
      return;
    }
    $ticker = $query-&gt;param('ticker');
    $begin_dt = $query-&gt;param('begin_dt');
    $end_dt = $query-&gt;param('end_dt');
    
    print "&lt;b&gt;FIRST:&lt;br /&gt;Ticker: $ticker&lt;br /&gt;Start date: $begin_dt&lt;br /&gt;End date: $end_dt&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;"; 
    
use Net::HTTP;
    
    print "&lt;b&gt;SECOND:&lt;br /&gt;Ticker: $ticker&lt;br /&gt;Start date: $begin_dt&lt;br /&gt;End date: $end_dt&lt;/b&gt;"; 
    
my $s = Net::HTTP-&gt;new(HOST =&gt; "localhost:5000");
    
    print "&lt;b&gt;THIRD:&lt;br /&gt;Ticker: $ticker&lt;br /&gt;Start date: $begin_dt&lt;br /&gt;End date: $end_dt&lt;/b&gt;";
    
    $s-&gt;write_request(GET =&gt; "/Aresult.pl?ticker=$ticker&amp;begin_dt=$begin_dt&amp;end_dt=$end_dt", 'User-Agent' =&gt; "Mozilla/5.0");
    ($code,$mess, %h) = $s-&gt;read_response_headers;
    while (1) {
      my $buf;
      my $n = $s-&gt;read_entity_body($buf,1024);
      last unless $n;
      print $buf;
    }
}&lt;/code&gt;
&lt;p&gt;But in the other cgi script, the following function works fine.&lt;/p&gt;
&lt;code&gt;
sub print_response {
    unless ($query-&gt;param) {
      print "&lt;b&gt;No data has been submitted&lt;/b&gt;";
      return;
    }
    $vdate = $query-&gt;param('vdate');
    $edate = $query-&gt;param('edate');
    $ot = $query-&gt;param('ot');
    $ul = $query-&gt;param('underlying');
    $strike = $query-&gt;param('strike');
    $dy = $query-&gt;param('dividendyield');
    $rfr = $query-&gt;param('riskfreerate');
    $vol = $query-&gt;param('volatility');
use Net::HTTP;
my $s = Net::HTTP-&gt;new(Host =&gt; "localhost:5000");
#my $s = Net::HTTP-&gt;new(Host =&gt; "192.168.2.104:5000");
$s-&gt;write_request(GET =&gt; "/calc.pl?&amp;vdate=$vdate&amp;edate=$edate&amp;optiontype=$ot&amp;underlying=$ul&amp;strike=$strike&amp;dividendyield=$dy&amp;riskfreerate=$rfr&amp;vol=$vol", 
		      'User-Agent' =&gt; "Mozilla/5.0");
my ($code,$mess, %h) = $s-&gt;read_response_headers;

while (1) {
  my $buf;
  my $n = $s-&gt;read_entity_body($buf,1024);
  last unless $n;
  print $buf;
}
}&lt;/code&gt;
&lt;p&gt;Apart from the name of the cgi scripts containing these two functions, and the details of these two functions, the scripts are mostly the same.&lt;/p&gt;
&lt;p&gt;The scripts are on the same machine, on the same instance of Apache's httpd (the latest version build for Windows - and I use the latest version of Activestate's Perl)&lt;/p&gt;
&lt;p&gt;What can possibly account for the difference int he behvaiour of these two functions.&lt;/p&gt;</field>
</data>
</node>
