The problem of delimiter under map routing in YAF

Source: Internet
Author: User

Because the URL of the user request under Map routing is based on the "/" rating corresponding to the controller in the directory under Controllers, the action defaults to indexaction, so you want to implement/key1/param1/key2/ Param2 This form of communication, it is necessary to delimiter the URL into Req_uri and query_str two parts.

In practice, the delimiter is defined (although it is not used), at this point, if the user's request (more crawler or sweep station) unintentionally contains the following form:/aaa/bbb[delimiter] (XXX)?/key1/param1/key2/ Param2., will cause the program to crash.

After the question was brought to the bird brother, bird brother quickly gave the repair (18~19 line):

1 if(Z_type_p (delimer) = =is_string2&&z_strlen_p (Delimer)) {3         if((Query_str =strstr(Req_uri, Z_strval_p (Delimer))) !=NULL4&& * (query_str-1) = = '/') {5TMP =Req_uri;6Rest = Query_str +z_strlen_p (delimer);7             if(*rest = = ' + ') {8Req_uri = Estrndup (Req_uri, Query_str-Req_uri);9Query_str =NULL;Ten Efree (TMP); One}Else if(*rest = = '/')) { AReq_uri = Estrndup (Req_uri, Query_str-Req_uri); -Query_str =Estrdup (rest); - Efree (TMP); the}Else { -Query_str =NULL; -             } -}Else { +Query_str =NULL; -}

After Delimer obtained query_str, Judge Delimer the previous character is "/" situation, but no judgment is not the case, resulting in non-compliance with/aaa/bbb/[delimer]/key1/param1/... The form of Urk is truncated to Req_uri and query_str to parse, so there is a problem with the program.

Thanks bird Brother Quick reply!

The problem of delimiter under map routing in YAF

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.