Forum Discussion

andreast_4666's avatar
Icon for Nimbostratus rankNimbostratus
Oct 11, 2011

Universal Persistence




I have been reading through the LTM Advance course book and have come up to universal persistence but am having trouble understanding an option in the example in the book:



when HTTP_REQUEST { persist uie [findstr [HTTP::uri] "user=" 5 "&"] }



Im trying to understand what the '5' in the persistence rule is?



they have a URI example of /env.cgi?user=123&pw456



Please any help would be much appreciated.



thanks in advance



2 Replies

  • Hi Andreas,

    You can read up on the details for findstr here:

    Basically, findstr is looking in the URI for the string "user=" and then skipping five characters forward from the first character of user= and reading up to the end of the URI or to the next &. It's trying to parse the value of the "user" parameter.

    You could do this simpler using URI::query:

    set user [URI::query [HTTP::uri] user]
    if {$user ne ""}{
       persist uie $user

    If you're on v9 or v10, you can use a workaround for a bug in those versions:

    set user [URI::query "?&[HTTP::query]" &user]
    if {$user ne ""}{
       persist uie $user