gitlab-org--gitlab-foss/app
Dmitriy Zaporozhets 6c7131b469 Merge branch 'fix-ext-issue-tracker-hook' into 'master'
Fix external issue tracker hook/test for HTTPS URLs

If HTTPS was used for the 'project_url' of an external issue tracker, an
error was raised because a HTTP connection was established to the
default HTTPS port.

The code has been corrected and simplified by using HTTParty.
Additionally, the request now is made directly to the 'project_url'
instead of the extracted root path.

## The bug is reproducible on gitlab.com
1. Set up a new external issue service (I used Redmine)
2. Set the project URL to 'http://example.com/redmine/projects/x' and
  click on 'Test settings' => Ok
3. Now set the URL to 'https://example.com/redmine/projects/x' and test
  it again => 500

## What is actually happening?
Web servers behave differently when a non-SSL connection is established
to a SSL port:
- Nginx / Apache 2.4: Status code 400
- Apache 2.2: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">...
  (no status code line is sent)
- example.com: Empty response, no status code line

## Relevant log entries
```
2015-06-04T11:10:47.972Z 16785 TID-exfks WARN: {"retry"=>true, "queue"=>"project_web_hook", "class"=>"ProjectServiceWorker", "args"=>[...], "error_message"=>"wrong status line: \"<!DOCTYPE HTML PUBLIC \\\"-//IETF//DTD HTML 2.0//EN\\\">\"", "error_class"=>"Net::HTTPBadResponse", ...}
2015-06-04T11:10:47.972Z 16785 TID-exfks WARN: wrong status line: "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">"
2015-06-04T11:10:47.972Z 16785 TID-exfks WARN: /usr/lib/ruby/2.1.0/net/http/response.rb:41:in `read_status_line'
[...]
/home/git/gitlab-7.11.4/app/models/project_services/issue_tracker_service.rb:88:in `execute'
/home/git/gitlab-7.11.4/app/workers/project_service_worker.rb:8:in `perform'
[...]
```

See merge request !767
2015-06-15 14:01:10 +00:00
..
assets Merge branch 'rs-dev-issue-2228' into 'master' 2015-06-15 11:29:36 +00:00
controllers Refactor RootController 2015-06-13 17:59:13 -04:00
finders Set milestone on new issue when creating issue from index with milestone filter active. 2015-05-27 14:22:11 +02:00
helpers Refactor dashboard_choices 2015-06-13 17:59:13 -04:00
mailers
models Merge branch 'fix-ext-issue-tracker-hook' into 'master' 2015-06-15 14:01:10 +00:00
services Merge branch 'fix-post-receive-external-tracker' into 'master' 2015-06-15 07:42:24 +00:00
uploaders
views Fix text align in last push event 2015-06-15 14:54:41 +02:00
workers