HTTP.
If used with debugging level of 3 or more, it will also create dumps of
-requests named C<< nr.dump >> where C<nr> is number from 0 to total number
+requests named C<< dump/nr.request >> where C<nr> is number from 0 to total number
of requests in single session.
=cut
warn "<<<< ", $sock->peerhost, " [" . localtime() . "] ", $r->method, " ", $r->uri, " $size bytes\n";
if ( $self->debug > 2 ) {
- my $file = $dump_nr++ . '.dump';
+ my $file = sprintf("dump/%04d-%s.request", $dump_nr++, $sock->peerhost);
write_file( $file, $r->as_string );
warn "### request dump: $file\n";
}
die "no SOAPAction header in ",dump($chunk) unless defined ( $r->header('SOAPAction') );
+ $state = CWMP::Request->parse( $chunk );
- if ( $chunk ) {
- warn "## request chunk: ",length($chunk)," bytes\n$chunk\n" if $self->debug;
+ warn "## acquired state = ", dump( $state ), "\n";
- $state = CWMP::Request->parse( $chunk );
+ $self->state( $state );
+ $self->store->update_state( ID => $state->{ID}, $state );
- warn "## acquired state = ", dump( $state ), "\n";
-
- $self->state( $state );
- $self->store->update_state( ID => $state->{ID}, $state );
+ } else {
- } else {
- warn "## empty request\n";
- }
+ warn "## empty request\n";
- } else {
$state = $self->state;
+ delete( $state->{_dispatch} );
warn "last request state = ", dump( $state ), "\n" if $self->debug > 1;
}
$xml = $self->dispatch('Inform', $response_arguments );
+If debugging level of 3 or more, it will create dumps of responses named C<< dump/nr.response >>
+
=cut
sub dispatch {
warn ">>> dispatching to $dispatch\n";
my $xml = $response->$dispatch( $self->state, @_ );
warn "## response payload: ",length($xml)," bytes\n$xml\n" if $self->debug;
+ if ( $self->debug > 2 ) {
+ my $file = sprintf("dump/%04d-%s.response", $dump_nr++, $self->sock->peerhost);
+ write_file( $file, $xml );
+ warn "### response dump: $file\n";
+ }
return $xml;
} else {
confess "can't dispatch to $dispatch";