From f5d9d9b5f8bce3c1f7003221e02877fcf7e9b727 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Fri, 3 May 2024 22:48:41 +0900 Subject: [PATCH] win32/sspi: Use `start_with?` to see prefix --- ext/win32/lib/win32/sspi.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ext/win32/lib/win32/sspi.rb b/ext/win32/lib/win32/sspi.rb index b4bddc67b3..f382f3cf50 100644 --- a/ext/win32/lib/win32/sspi.rb +++ b/ext/win32/lib/win32/sspi.rb @@ -283,12 +283,12 @@ module Win32 # Nil token OK, just set it to empty string token = "" if token.nil? - if token.include? "Negotiate" + if token.start_with? "Negotiate" # If the Negotiate prefix is passed in, assume we are seeing "Negotiate " and get the token. - token = token.split(" ").last + token = token.split(" ", 2).last end - if token.include? B64_TOKEN_PREFIX + if token.start_with? B64_TOKEN_PREFIX # indicates base64 encoded token token = token.strip.unpack1("m") end @@ -309,7 +309,7 @@ module Win32 clean_up unless @cleaned_up end - private + private def clean_up # free structures allocated