允许具有奇怪的Jakarta / ISAPI错误的IIS 7和CF10的URL中的百分号%

时间:2014-01-20 23:10:35

标签: iis iis-7 coldfusion coldfusion-10

我似乎遇到了包含百分号的网址问题。例如,这个URL没问题:

http://example.com/json.cfm/json_type/answer_grid/league/268/survey_id/323/requesttimeout/50000/team_view/0/division_id/0/group/0/return_script/1

但是,此URL失败。

http://example.com/json.cfm/json_type/answer_grid/league/268/survey_id/323/requesttimeout/50000/team_view/0/division_id/0/group/0/return_script/%

它似乎产生了一个神秘的Jakarta / ISAPI错误:

  

在此服务器上找不到请求的网址!如果您输入了URL   请手动检查您的拼写,然后重试。雅加达/ ISAPI / isapi_redirector / 1.2.32()

系统似乎拒绝百分号。我怎么能允许这个通过?我试图传递的完整网址是:

http://example.com/json.cfm/json_type/answer_grid/league/268/survey_id/323/requesttimeout/50000/team_view/0/division_id/0/group/0/return_script/%2Fmanager%5Fpro%2Ecfm%2Fleague%2F268%2Faction%2Fregistration%2Fcontent%5Faction%2Fmanagesurveys%2Ftabindex%2F1

注意这一个工作

http://example.com/json.cfm?json_type=answer_grid&league=268&survey_id=323&requesttimeout=50000&team_view=0&division_id=0&group=0&return_script=%2Fmanager%5Fpro%2Ecfm%2Fleague%2F268%2Faction%2Fregistration%2Fcontent%5Faction%2Fmanagesurveys%2Ftabindex%2F1

我在CF9上使用此代码来转换URL,它可以正常工作:

<cffunction name="set_spider_friendly_urls" access="remote" returntype="string">
    <cfset cfmx7_updated_path_info = "#cgi.script_name#/cgi.path_info"> 
    <cfif findnocase("#cgi.script_name#/",cfmx7_updated_path_info) and not len(query_string)>
        <cftry>
            <CFSET str_path=replacenocase(cgi.path_info,"#cgi.script_name#/","","all")>
            <CFSET str_path=replace(str_path,"//","/ /","all")>
            <CFSET clear=structclear(url)>
            <CFSET int_len=listlen(str_path,"/")>
            <CFSET str_delim="/">
            <cfloop index="int_cur" from="1" to="#int_len#" step="2">
                <cfif int_cur eq int_len>
                    <CFSET clear=setvariable("url.#listgetat(str_path,int_cur,str_delim)#","")>
                <cfelse>
                    <CFSET tmp_var=rereplace(listgetat(str_path,int_cur+1,str_delim),"["",/\\\*&()$%^@~´?;'']","","all")>
                    <CFSET clear=setvariable("url.#listgetat(str_path,int_cur,str_delim)#",tmp_var)>
                </cfif>
            </cfloop>
            <CFSET bln_newurl=1>
            <CFSET str_currentpage=cgi.path_info>
            <cfcatch>
                <cffile action="APPEND" file="#ExpandPath( "./" )#cc_gateway_logs\hurl.log" output="#now()#,#remote_addr#,#cgi.path_info#" addnewline="Yes">
            </cfcatch>
        </cftry>
    <cfelse>
        <CFSET str_currentpage=replacelist("#cgi.script_name#?#cgi.query_string#","?,&,=","/,/,/")>
        <CFSET bln_newurl=0>
    </cfif>
    <cfreturn cfmx7_updated_path_info>
</cffunction>

1 个答案:

答案 0 :(得分:0)

%通常用于编码值,这意味着大多数服务器或服务都会尝试对其进行解码。因此,您需要先对其进行编码。

%编码为%25