Skip to content

fix header set-cookie regexp #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/casclient/responses.rb
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,10 @@ def initialize(http_response = nil, options={})
def parse_http_response(http_response)
header = http_response.to_hash

# FIXME: this regexp might be incorrect...

if header['set-cookie'] &&
header['set-cookie'].first &&
header['set-cookie'].first =~ /tgt=([^&]+);/
header['set-cookie'].first =~ /tgt=([^&]+)/
@tgt = $~[1]
end

Expand All @@ -191,7 +191,7 @@ def parse_http_response(http_response)
@ticket = $~[1]
end

if not ((http_response.kind_of?(Net::HTTPSuccess) || http_response.kind_of?(Net::HTTPFound)) && @ticket.present?)
if not ((http_response.kind_of?(Net::HTTPSuccess) || http_response.kind_of?(Net::HTTPFound) || http_response.kind_of?(Net::HTTPSeeOther)) && @ticket.present?)
@failure = true
# Try to extract the error message -- this only works with RubyCAS-Server.
# For other servers we just return the entire response body (i.e. the whole error page).
Expand Down