none
Extracting rule creation, need help. RRS feed

  • Question

  • Hi,

    Actually, in a web request at header, I have to capture the ReQ_ID which ends with nothing.

    HTTP/1.1 200 OK
    Transfer-Encoding : chunked
    Content-Encoding : gzip
    Vary : Accept-Encoding
    REQ_ID : 30a8911c-1699-4462-89df-2b558fd451ac

    Persistent-Auth : true
    Cache-Control : public
    Content-Type : text/javascript; charset=utf-8

    I have written the rule  like :

     ExtractText extractionRule2 = new ExtractText();
                {
                    extractionRule2.StartsWith = "REQ_ID :";
                    extractionRule2.EndsWith = "";
                    extractionRule2.IgnoreCase = false;
                    extractionRule2.UseRegularExpression = false;
                    extractionRule2.Required = true;
                    extractionRule2.ExtractRandomMatch = false;
                    extractionRule2.Index = 0;
                    extractionRule2.HtmlDecode = true;
                    extractionRule2.SearchInHeaders = true;
                    extractionRule2.ContextParameterName = "REQ_ID";
                };

    But it's taking the next line item also.

    In actual in context variable it stores : 

    30a8911c-1699-4462-89df-2b558fd451acPersistent-Auth : true
    Cache-Control : public
    Content-Type : text/javascript; charset=utf-8

    What would be the endswith in this case ?

    Thursday, May 30, 2019 1:40 AM

All replies

  • Actually the line ends with "/r/n" (i.e.: CR+LF) if it were HTTP header. It's specified in RFC2616 Section 4.1.

    *(message-header CRLF) means "any number of "message-header" (as defined in Section 4.2) ends with CRLF

    Thursday, May 30, 2019 2:31 AM
    Answerer
  • Hi,

    Tried :

     ExtractText extractionRule2 = new ExtractText();
                {
                    extractionRule2.StartsWith = "REQ_ID : ";
                    extractionRule2.EndsWith = "/r/n";
                    extractionRule2.IgnoreCase = false;
                    extractionRule2.UseRegularExpression = false;
                    extractionRule2.Required = true;
                    extractionRule2.ExtractRandomMatch = false;
                    extractionRule2.Index = 0;
                    extractionRule2.HtmlDecode = true;
                    extractionRule2.SearchInHeaders = true;
                    extractionRule2.ContextParameterName = "REQ_ID";
                };

    Now, it's failing and says :

    ExtractText Extraction StartsWith text was not found in the response StartsWith=REQ_ID : , EndsWith=/r/n, IgnoreCase=False, UseRegularExpression=False, Required=True, ExtractRandomMatch=False, Index=0, HtmlDecode=True, SearchInHeaders=True, ContextParameterName=REQ_ID

    Previously, it was passed Endswith "" but the next line text is also coming.

    Actual response Header :

    HTTP/1.1 200 OK
    Transfer-Encoding : chunked
    Content-Encoding : gzip
    Vary : Accept-Encoding
    REQ_ID : aea617a5-131f-46cc-ac8b-2f8d16f8082f
    Persistent-Auth : true
    Cache-Control : public
    Content-Type : text/javascript; charset=utf-8
    Date : Thu, 30 May 2019 02:35:12 GMT
    Expires : Fri, 29 May 2020 02:35:12 GMT
    Server : Microsoft-IIS/8.5
    X-AspNet-Version : 4.0.30319
    X-Powered-By : ASP.NET

    Want to retrieve req. id : aea617a5-131f-46cc-ac8b-2f8d16f8082f

    Thursday, May 30, 2019 2:45 AM
  • Don't know whether your ExtractText class removes newline characters. If so, it will not work.

    The other possibility is that, the REQ_ID is inserted without ending it with "/r/n", in that case it's correct to treat the next header as part of content of this header.

    You may want to save the whole request as a file and open it with binary editor to verify.

    If indeed it's not ended with "\r\n", you may want to talk with people writing code to add this header to fix it, or to break it yourself if you see other line break is used. (say, if only "\n" is used only, set that as .EndsWith will do.)


    Thursday, May 30, 2019 5:39 AM
    Answerer
  • Hi Indrajit,

    For your question, I want to know what your current project is. If your current project is Asp.net application, I suggest that you could post in the asp.net forum.

    We are waiting for your update.

    Best Regards,

    Jack


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, May 30, 2019 9:32 AM
    Moderator