--- trunk/Estraier.pm 2006/01/05 22:27:03 38 +++ trunk/Estraier.pm 2006/01/05 22:36:10 39 @@ -689,6 +689,11 @@ }; bless($self, $class); + if (@_) { + $self->{debug} = 1; + warn "## Node debug on\n"; + } + $self ? return $self : return undef; } @@ -837,10 +842,13 @@ return -1; } + warn "## headers:\n$headers\n" if ($self->{debug}); + print $sock $headers or carp "can't send headers to network:\n$headers\n" and return -1; if ($reqbody) { + warn "## request body:\n$headers\n" if ($self->{debug}); print $sock $$reqbody or carp "can't send request body to network:\n$$reqbody\n" and return -1; } @@ -850,7 +858,8 @@ my ($schema, $res_status, undef) = split(/ */, $line, 3); return if ($schema !~ /^HTTP/ || ! $res_status); - $self->{status} = $res_status; + $status = $res_status; + warn "## response status: $res_status\n" if ($self->{debug}); # skip rest of headers $line = <$sock>; @@ -867,6 +876,9 @@ $$resbody .= $buf if ($resbody); } while ($len); + + warn "## response body:\n$$resbody\n" if ($self->{debug}); + return $status; }