Fix default value for HostingService._http_request headers parameter

The default value for the 'headers' parameter to the _http_request was None,
which meant that if something called it without passing in headers,
urllib2.Request()'s constructor would throw an exception. Other similar code
uses a default value of an empty dictionary, which is more appropriate.

Reviewed at https://reviews.reviewboard.org/r/4392/
Allow HostingServices to validate repositories.

A HostingService may know best whether a given repository configuration
is valid. In the case of HTTPS-backed repositories, it's actually
preferable that the HostingService does the check, since the Repository
entry may not have an associated username/password stored.

Now, when validating repositories, we go through the HostingService, if
one is selected. That will fall back to the SCMTool's validation, unless
a subclass overrides validate_repository and provides this
functionality.

The webapi implementation of repository validation does not make use of
this, since at that level, there's no information on the hosting service
data. When repository configuration is rewritten, that may change. For
now, it's assumed that anyone going through the API is just setting up
standard repositories in-house.

Beanstalk will be making use of this in an upcoming change.
Pass on base_commit_id to hosting services for file lookups.

The base_commit_id is now passed on to the get_file/get_file_exists
functions in hosting services, so that they may make use of it when
fetching file data.

It's not passed on to SCMTools, since we currently have no need there,
but it can be added later if needed.

This, combined with some upcoming changes, will allow us to support
services like Beanstalk and BitBucket for Git.
Use escapejs on URL and captions for file attachments.

Most URLs are fine, but in the case where we're using authenticated URLs with
S3, we'll have &amp; in the URL where we wanted &.
Add support for Beanstalk as a hosting service.

This supports both Git and Subversion repositories on Beanstalk. It
makes use of the new base_commit_id support and hosting service
repository validation.

Unit tests were added for all the new functionality.