I'm trying to compose traffic script rule to get username and password which can be provided by user.
$user = request.getLine( "\n", $1);
$pass = request.getLine( "\n", $2);
But its not working, breaking after fisrt enter for user.
Any help appreciated.
Hello, can you provide more information about the type of application that you are trying to authenticate here, and which type of virtual server you have configured? request.getLine() will not work with HTTP applications, it works at the level below HTTP.
If you are looking to authenticate an HTTP application, there are a few other useful articles on how to use a 401 response to authenticate:
And also here, a much more complex example:
The service is SMTP on port 25, Virtual Server configured for SMTP. So I need to get username and password from user.
ok - there is an article here on reading and processing SMTP - it does not cover the specifics of reading user/pwd, but may be of use. I noticed that the body of the SMTP message is ready with $line = request.getline("\r\n", $next); which uses "\r\n" as the line terminator.
Let me know if this is useful:
Replaced \n with \r\n but with no luck:
$user = request.getLine( "\r\n", $1);
$pass = request.getLine( "\r\n", $2);
But still not working, still breaking after fisrt line enter for $user.
Not sure if arguments $1 and $2 are correct. After entering username script must wait for entering password and assign username to $user and password to $pass.
Is it possible to use 2 operators request.getLine in one traffic script rule?
Have you tried to use log.info() to trace individual steps? That can sometimes help.
if you think that getLine() is not performing correctly, then it may be best to log a support call and they can look into it.