Skip to content

Commit

Permalink
Support HTTP and HTTPS connections to unfuddle, defaulting to HTTPS
Browse files Browse the repository at this point in the history
Existing service configurations do not represent their preference for
HTTP over HTTPS, so it is assumed that they will need to continue using
HTTPS.

This change changes the logic to only switch the protocol from HTTPS to
HTTP if it is requested by the user configuring the service instance.
This makes the change opt-in and therefore backwards compatible with
existing data, while still providing the opportunity to switch over to
plain HTTP for API usage, which is really the only way to use the API
for the smaller Unfuddle plans.
  • Loading branch information
perropicante committed Mar 13, 2012
1 parent de70abe commit 8e3f263
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion docs/unfuddle
Expand Up @@ -27,4 +27,4 @@ data
- subdomain
- username (Unfuddle API account holder)
- password (Unfuddle API account password)
- ssl (Unfuddle account with SSL support)
- httponly (Unfuddle accounts mostly support HTTPS; HTTP can be used for accounts where HTTPS is not supported)
8 changes: 4 additions & 4 deletions services/unfuddle.rb
@@ -1,17 +1,17 @@
class Service::Unfuddle < Service
string :subdomain, :repo_id, :username
password :password
boolean :ssl
boolean :httponly

def receive_push
u_repoid = data['repo_id'].to_i
repository = payload['repository']['name']
branch = branch_name
before = payload['before']
# use https for accounts that support SSL
scheme = "http#{(data['ssl'].to_i == 1 && 's') || ''}"
# use https by default since most accounts support SSL
protocol = data['httponly'].to_i == 1 ? 'http' : 'https'

http.url_prefix = "#{scheme}://#{data['subdomain']}.unfuddle.com"
http.url_prefix = "#{protocol}://#{data['subdomain']}.unfuddle.com"
http.basic_auth data['username'], data['password']

# grab people data for matching author-id
Expand Down

0 comments on commit 8e3f263

Please sign in to comment.