Created
June 21, 2013 20:11
-
-
Save olivier-schmitt/5833973 to your computer and use it in GitHub Desktop.
Vérifie que le cookie de session renvoyé dans la réponse correspond bien au cookie de session de la requête
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (ResponseCode != null && ResponseCode.equals ("200") == false ) | |
{ | |
Failure= false ; | |
} | |
else | |
{ | |
if (ResponseCode != null && ResponseCode.equals ("200") == true ) | |
{ | |
if(SamplerData.contains("[no cookies]")) | |
{ | |
Failure= false ; | |
} | |
else | |
{ | |
int startOffset = SamplerData.indexOf("JSESSIONID=") + "JSESSIONID=".length(); | |
int endOffset = SamplerData.indexOf("\\r",startOffset); | |
String sessionRequest = SamplerData.substring(startOffset); | |
startOffset = ResponseHeaders.indexOf("Set-Cookie: JSESSIONID=") + "Set-Cookie: JSESSIONID=".length(); | |
endOffset = ResponseHeaders.indexOf(";",startOffset); | |
String sessionResponse = ResponseHeaders.substring(startOffset,endOffset); | |
if(sessionRequest.contains(sessionResponse)) | |
{ | |
log.info("OK " + sessionResponse); | |
Failure= false ; | |
} | |
else | |
{ | |
log.info( "MIXING : " + sessionRequest + "!=" + sessionResponse); | |
Failure= true ; | |
} | |
} | |
} | |
else | |
{ | |
Failure= false ; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment