Ad Widget

Collapse

URL Encoding Web Monitoring Variables

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jonathann
    Junior Member
    • Mar 2014
    • 2

    #1

    URL Encoding Web Monitoring Variables

    I need to URL encode/escape viewstate variables read from a page before posting the back to the server. I found this ticket in my search for options:



    I looked into the source a bit and modified the web monitoring piece to include a new scenario variable prefix in the spirit of "regex:". My "regexenc:" does the same work as "regex:", but uses libcurl to URL escape the results of the regex match. This let me successfully automate a login to a legacy .NET webforms application I am maintaining.

    Now, this was a small thing and it may be rough. I don't have a lot of experience with working on C, so tell me if I get some basic things wrong or if I should refactor a bit. For example, should the curl_easy_escape calling code be it's own method? Should I separate out the if block for testing for "regex:" or "regexenc:" into two if blocks? I think I did alright with cleaning up allocated strings, but a second set of eyes would be good. Thanks, and I hope this can be the start of a useful if small contribution.
    Attached Files
    Last edited by jonathann; 18-03-2014, 14:16.
  • BDiE8VNy
    Senior Member
    • Apr 2010
    • 680

    #2
    Since:
    All unsafe characters must always be encoded within a URL. For
    example, the character "#" must be encoded within URLs even in
    systems that do not normally deal with fragment or anchor
    identifiers, so that if the URL is copied into another system that
    does use them, it will not be necessary to change the URL encoding.



    It should be safe to always escape dynamically extracted values - I think.
    See another patch proposal.

    Comment

    Working...