Skip to content

Commit

Permalink
Merge pull request #2823 from ganmacs/fix-when-origin-is-nil
Browse files Browse the repository at this point in the history
Fix when origin is nil in http input plugin
  • Loading branch information
ganmacs authored Feb 12, 2020
2 parents 4690f12 + ed85d4f commit 1b3a8be
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions lib/fluent/plugin/in_http.rb
Original file line number Diff line number Diff line change
Expand Up @@ -526,14 +526,20 @@ def send_response_nobody(code, header)
end

def include_cors_allow_origin
if @origin.nil?
return false
end

if @cors_allow_origins.include?(@origin)
return true
end
filtered_cors_allow_origins = @cors_allow_origins.select {|origin| origin != ""}
return filtered_cors_allow_origins.find do |origin|
(start_str,end_str) = origin.split("*",2)
@origin.start_with?(start_str) and @origin.end_with?(end_str)
end != nil
r = filtered_cors_allow_origins.find do |origin|
(start_str, end_str) = origin.split("*", 2)
@origin.start_with?(start_str) && @origin.end_with?(end_str)
end

!r.nil?
end
end
end
Expand Down

0 comments on commit 1b3a8be

Please sign in to comment.