Skip to content

Commit

Permalink
Merge pull request #2320 from mschnitzer/spider_identification
Browse files Browse the repository at this point in the history
Add new way to identify spider bots
  • Loading branch information
hennevogel committed Nov 23, 2016
2 parents 7cadf70 + ebed6fc commit ec3c2de
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/ReleaseNotes-2.7
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ Webui Features
`Content-Disposition: attachment`, which makes Firefox prompt the user to
download the file rather than simply showing the text within the browser.
* Improve load time when loading open requests for a user on profile page.
* The way to identify spiders got changed. A separate configuration via
apache is no longer required. See the Administration Guide.


Notes for systems using systemd:
Expand Down
2 changes: 2 additions & 0 deletions src/api/Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ gem 'flot-rails'
gem 'colorize', require: false
# XML Serialization got moved here
gem 'activemodel-serializers-xml'
# Spider Identification
gem 'voight_kampff'

group :development, :production do
# to have the delayed job daemon
Expand Down
5 changes: 5 additions & 0 deletions src/api/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,8 @@ GEM
rack
unicorn
vcr (3.0.3)
voight_kampff (1.1.1)
rack (>= 1.4, < 3.0)
webmock (2.1.0)
addressable (>= 2.3.6)
crack (>= 0.3.2)
Expand Down Expand Up @@ -396,7 +398,10 @@ DEPENDENCIES
uglifier (>= 1.2.2)
unicorn-rails
vcr
voight_kampff
webmock (>= 1.18.0)
xmlhash (>= 1.3.6)
yajl-ruby

BUNDLED WITH
1.12.5
2 changes: 1 addition & 1 deletion src/api/app/controllers/webui/webui_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def instantiate_controller_and_action_names
# Needed to hide/render some views to well known spider bots
# FIXME: We should get rid of it
def check_spiders
@spider_bot = request.env.has_key?('HTTP_OBS_SPIDER')
@spider_bot = request.bot?
end
private :check_spiders

Expand Down
3 changes: 2 additions & 1 deletion src/api/spec/controllers/webui/project_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@

context 'showing projects being a spider bot' do
before do
request.env['HTTP_OBS_SPIDER'] = true
# be a fake google bot
request.env['HTTP_USER_AGENT'] = 'Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)'
get :index
end

Expand Down

0 comments on commit ec3c2de

Please sign in to comment.