DBD::Gofer::Transport::http - DBD::Gofer client transport using http
my $remote_dsn = "..." DBI->connect("dbi:Gofer:transport=http;url=http://gofer.example.com/gofer;dsn=$remote_dsn",...)
or, enable by setting the DBI_AUTOPROXY environment variable:
which will force all DBI connections to be made via that Gofer server.
Connect with DBI::Gofer servers that use http transports, i.e., DBI::Gofer::Transport::mod_perl.
See DBD::Gofer::Transport::Base for a description of the Gofer transport attributes that are common to all transports, and another common features such as enabling gofer transport tracing.
The DBD::Gofer::Transport::http transport doesn't add any extra attributes.
The timeout provided by DBD::Gofer::Transport::Base is used. The
go_timeout value is also passed to LWP::UserAgent as its timeout value. In practice the DBD::Gofer::Transport::Base timeout would almost certainly fire first. This area is subject to change in future releases.
The request is sent as a POST with a content type of '
The user-agent string is '
$response = $transport->transmit_request_by_transport( $request );
This method isn't used because transmit_request_by_transport() always returns a response object. If called it throws an exception.
$retry = $transport->response_retry_preference($request, $response);
The response_retry_preference is called by DBD::Gofer when considering if a request should be retried after an error.
Returns true (would like to retry), false (must not retry), undef (no preference).
If a true value is returned in the form of a CODE ref then, if DBD::Gofer does decide to retry the request, it calls the code ref passing $retry_count, $retry_limit. Currently the called code must return using
Drops any persistent-connections associated with the transport.
These environment variables are not considered a stable part of the interface and they may change between releases. (The general plan is for corresponding gofer transport attributes to be added. That would enable per-handle configuration. Patches welcome.)
Specifies the size of the persistent-conection cache for the transport object. Default is 10. Set to 0 to disable use of HTTP/1.1 persistent-conections.
Emit a warn() whenever a request is retried.
Specifies the amount to multiply the retry delay by on each retry. Default value 2.
Initial delay, in seconds, before retrying after a request receives a 503 response. (The DBD_GOFER_RETRY_BACKOFF_SCALE is applied first, so the actual initial delay is this value multipled by DBD_GOFER_RETRY_BACKOFF_SCALE). Default value 0.2.
Used to workaround problems with buggy load balancers (e.g. a Juniper DX with standing connections enabled) which cause some requests to fail whithout ever reaching the gofer server.
If set to 1 then empty responses will be retried. If is_idempotent() is true then upto 20 retries will be performed, else just 1 retry. The retries happen without any delay and log a warning each time.
If set to a higher value then the retry counts are multiplied by that amount, so a value of 3 will retry idempotent requests 30 times, for example.
This mechanism is not recommended for non-readonly databases because there's a risk that the server did receive and act on the request, so retrying it would cause the database change to be repeated, which may cause other problems.
There is currently no support for http authentication.
Please report any bugs or feature requests to
email@example.com, or through the web interface at http://rt.cpan.org.
Tim Bunce, http://www.tim.bunce.name
Copyright (c) 2007, Tim Bunce, Ireland. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.