27 Replies Latest reply: Oct 8, 2013 1:04 PM by henrylearn2rock RSS

    CGI.PATH_INFO is blank in CF 10

    ColdFusionSmurf Community Member

      I know this was an issue that was supposedly fixed in the first update, but I applied that and I'm still experiencing the error.  Any ideas?

       

      Version says ColdFusion 10,283649

        • 1. Re: CGI.PATH_INFO is blank in CF 10
          Anit_Kumar Adobe Employee

          CGI.PATH_INFO should be empty for a request URL like http://myserver/index.cfm

           

          In case your URL is like http://myserver/index.cfm/hello, you will get the CGI.PATH_INFO as “/hello”

           

          JRun which was the underlying server for CF 9 and earlier was actually giving a wrong value for PATH_INFO and that is why you see this change in behavior. You can also see this http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpServletRequest.html#getPath Info().

          • 2. Re: CGI.PATH_INFO is blank in CF 10
            ColdFusionSmurf Community Member

            Thank you for your response, but that is not the issue.  CGI.PATH_INFO is always blank, no matter where I am within the directory structure.  This was a bug (3305486) in CF10 but was supposedly fixed in updater 1:

            http://helpx.adobe.com/coldfusion/kb/coldfusion10-update-01.html

             

            I have installed that update.  In fact, I have installed and reinstalled it several times.  It has never fixed the issue for me, and I'm wondering if there are any other suggestions.

             

            My machine is:

             

            Windows 2008 R2

            IIS 7.0

            ColdFusion 10,283649

            • 3. Re: CGI.PATH_INFO is blank in CF 10
              Anit_Kumar Adobe Employee

              Can you please reconfigure the connector after applying the update (CF 10 Update 1) and check if this still does not work for you?

              • 4. Re: CGI.PATH_INFO is blank in CF 10
                Adam Cameron. Community Member

                It works OK for me on CF10 using the inbuilt web server. Can you test whether it is likewise with you? It might be something peculiar to IIS that is still broken, or a vagary of your config..?

                 

                --

                Adam

                • 5. Re: CGI.PATH_INFO is blank in CF 10
                  itisdesign MVP

                  Hi ColdFusionSmurf,

                   

                  I just verified that ColdFusion 10,282462 (w/ 0 CF updates installed) on IIS7.5 correctly returns CGI.PATH_INFO as "/foo" for "http://localhost/index.cfm/foo"

                   

                  #3305486, which Update 1 fixed, was specific to URL Rewriting.

                   

                  Can you please post an example of a URL path for which CGI.PATH_INFO is empty but shouldn't be?

                   

                  Thanks,

                  -Aaron

                  • 6. Re: CGI.PATH_INFO is blank in CF 10
                    sduncanute Community Member

                    I just discovered this problem after migrating from CF9 to CF10.  I have applied all of the patches and have been relying on CGI.PATH_INFO in a breadcrumb tag.  That tag is all over my website and now returns only the 'home' link which doesn't use the CGI.PATH_INFO tag. 

                     

                    This page is testing the the CGI.PATH_INFO and is returning nothing 

                     

                    http://www.ute-sei.org/English/sue.cfm

                     

                    Sue

                    • 7. Re: CGI.PATH_INFO is blank in CF 10
                      Anit_Kumar Adobe Employee

                      Hello,

                       

                      As per the Servlet spec, CGI.PATH_INFO should be empty for a request URL like http://myserver/index.cfm

                       

                      In case your URL is like http://myserver/index.cfm/hello, you will get the CGI.PATH_INFO as “/hello”

                       

                      JRun which was the underlying server for CF 9 and earlier was actually giving a wrong value for PATH_INFO and that is why you see this change in behavior. You can refer to http://docs.oracle.com/javaee/1.2.1/api/javax/servlet/http/HttpServletRequest.html#getPath Info().

                       

                      Regards,

                      Anit Kumar

                      • 8. Re: CGI.PATH_INFO is blank in CF 10
                        sduncanute Community Member

                        I am getting NOTHING regardless of how deep the path is.  The breadcrumb code which was working in CF9 relies on this and right now a page like:

                         

                        http://www.ute-sei.org/English/committees/tech-change/2012/minutes-sub-nov-21-2012.cfm

                         

                        has no breadcrumbs because that path provides nothing.

                         

                        This is broken and means I'm going to have to make coding changes that I shouldn't have to.

                         

                        Sue

                        • 9. Re: CGI.PATH_INFO is blank in CF 10
                          ColdFusionSmurf Community Member

                          @sduncanute

                           

                          Sorry to hear you're running into the same problems.  Unfortunately, I was never able to fix it and the people around here don't seem to believe me and therefore aren't very helpful.  I don't know how much plainer you can say "I'm never getting a value in my PATH_INFO" but apparently it's not getting through.

                           

                          My suggestion to you would be to replace all instances of CGI.PATH_INFO with something like request.cgiPath and then set that request variable in your application.cfc.  I ended up doing:

                           

                          <cfset request.cgiPath = getPageContext().getRequest().getRequestURI() />

                           

                          That pretty much gave me the same thing, and I really needed to solve the issue immediately.  I don't know about you but I couldn't afford to wait around for someone in these forums to actually believe me.

                          • 10. Re: CGI.PATH_INFO is blank in CF 10
                            Anit_Kumar Adobe Employee

                            Hello,

                             

                            JRun was the underlying server for CF 9 and earlier was actually giving a wrong value for PATH_INFO. In CF 10 there is a change in the behavior. Thus with CF10, you will have to use http://myserver/index.cfm/hello, you will get the CGI.PATH_INFO as “/hello”

                             

                            Regards,

                            Anit Kumar

                            • 11. Re: CGI.PATH_INFO is blank in CF 10
                              sduncanute Community Member

                              I don't have ANY urls have have a /anything after the .cfm file so Anit, repeating your message over and over is not helpful, nor does it add anything to this thread.

                               

                              Again, there is nothing in that variable no matter now many subdirectories down the file is.

                               

                              Sue

                               

                              p.s. @ColdFusionSmurf, thanks for the message and I'll look at implementing something like that.

                              • 12. Re: CGI.PATH_INFO is blank in CF 10
                                Anit_Kumar Adobe Employee

                                Hello Sue,

                                 

                                Apologies for being not of much help to you. You can alternatively use PATH_TRANSLATED.

                                 

                                Regards,

                                Anit Kumar

                                • 13. Re: CGI.PATH_INFO is blank in CF 10
                                  itisdesign MVP

                                  Updated: Changed "In the 1st example" to "In the examples".

                                   

                                  Hi ColdFusionSmurf and Sue,

                                   

                                  Anit is, of course, correct (thus the repeated answer). The "directory structure" and "extra path info" both refer to different parts of the request's URL.  Neither CGI.SCRIPT_NAME is the "/the/directory/structure/scriptname.cfm", which I believe was the desired part of the URL?  I will try to further explain..

                                   

                                  Example*: http://domain.com/the/directory/structure/scriptname.cfm/extra/path/info;jsessionid=the_jsessionid_here

                                   

                                  CF9's CGI.SCRIPT_NAME: /the/directory/structure/scriptname.cfm

                                  CF9's CGI.PATH_INFO: /extra/path/info

                                  CF9's getPageContext().getRequest().getRequestURI(): /the/directory/structure/scriptname.cfm/extra/path/info;jsessionid=the_jsessionid_here

                                  CF10's CGI.SCRIPT_NAME: /the/directory/structure/scriptname.cfm

                                  CF10's CGI.PATH_INFO: /extra/path/info

                                  CF10's getPageContext().getRequest().getRequestURI(): /the/directory/structure/scriptname.cfm/extra/path/info;jsessionid=the_jsessionid_here

                                   

                                  Example*: http://domain.com/the/directory/structure/scriptname.cfm;jsessionid=the_jsessionid_here

                                   

                                  CF9's CGI.SCRIPT_NAME: /the/directory/structure/scriptname.cfm

                                  CF9's CGI.PATH_INFO: /the/directory/structure/scriptname.cfm;jsessionid=the_jsessionid_here (incorrect - pre-CF10 bug)

                                  CF9's getPageContext().getRequest().getRequestURI(): /the/directory/structure/scriptname.cfm;jsessionid=the_jsessionid_here

                                  CF10's CGI.SCRIPT_NAME: /the/directory/structure/scriptname.cfm

                                  CF10's CGI.PATH_INFO: [empty string] (correct - CF10 fixed the bug)

                                  CF10's getPageContext().getRequest().getRequestURI(): /the/directory/structure/scriptname.cfm;jsessionid=the_jsessionid_here

                                   

                                  1) Using getPageContext().getRequest().getRequestURI() may not always return the desired result.

                                  2) Using CGI.PATH_INFO to get the /the/directory/structure/scriptname.cfm was incorrect, and CF10 corrected this.

                                   

                                  I'd recommend, in Application.cfm/cfc:

                                   

                                  <cfscript>

                                    REQUEST.cgi = duplicate(CGI);

                                  </cfscript>

                                   

                                  And then, in code, prefix CGI variables w/ "REQUEST.cgi." instead of "CGI.".

                                   

                                  If that had been done, then a workaround (until existing code could be fixed) would've been as simple as (in Application.cfm/cfc):

                                   

                                  <cfscript>

                                    REQUEST.cgi = duplicate(CGI);

                                    if(!len(REQUEST.cgi.path_info)) {

                                      REQUEST.cgi.path_info = REQUEST.cgi.script_name;

                                    }

                                  </cfscript>

                                   

                                  * - The JSessionID is appended by urlSessionFormat() if J2EE sessions are enabled, and if cookies are disabled in the browser, and if the session scope is enabled for the Application.

                                   

                                  Note: In the examples, the ".cfm" (or any extension) is actually optional, if web.xml (and uriworkermap.properties in CF10) contain(s) a mapping for the extensionless file. That can be helpful for setting up URLs such as http://domain.com/go/extra/path/info. But that is beyond the scope of this issue.

                                   

                                  Thanks,

                                  -Aaron

                                   

                                  Message was edited by: itisdesign Removed "Neither" (red).  Added CGI.SCRIPT_NAME and the missing part of the example URL throughout the discussion (green).  I was updating the Example URLs to make multiple points and ended up making neither point correctly.  The main points were: 1) CGI.PATH_INFO is the "*extra* path info" which _follows_ CGI.SCRIPT_NAME.  2) Pre-CF10, CGI.PATH_INFO incorrectly returned CGI.SCRIPT_NAME, and sometimes JSessionID, if "extra path info" didn't exist.  3) CGI.SCRIPT_NAME is the variable to use, as per the code example below.  4) getPageContext().getRequest().getRequestURI() sometimes includes JSessionID, so caution should be used when using this to essentially get CGI.SCRIPT_NAME.

                                  • 14. Re: CGI.PATH_INFO is blank in CF 10
                                    sduncanute Community Member

                                    Actually the information ColdFusionsmurf provided allowed me to fix the code the the breadcrumbs code I was trying to run.  I had NO interest in the final page.  I'm on the final page when I'm putting the breadcrumb info on it.  What I was looking for is building links to the directories above it, so that I had a true breadcrumb.

                                     

                                    The code worked under CF9 and broke under CF10 giving me NOTHING in that field regardless of where in the directory tree structure I called it from. 

                                     

                                    With the changes ColdFusionsmurf suggested, it is working, though it is showing the final page, which I didn't have before, not needed but at least it's not breaking anything.

                                     

                                    You can see the resultant breadcrumb on this page:

                                     

                                    home  »  English
                                    »  committees
                                    »  communications
                                    »  2012
                                    »  report-sept-2012.cfm

                                     

                                    http://www.ute-sei.org/English/committees/communications/2012/report-sept-2012.cfm

                                     

                                    I still believe that CF10 is broken, since NOTHING would show on a page like the one above in CF10 and it would in CF9 and I have had to write a workaround.

                                     

                                    Sue

                                    • 15. Re: CGI.PATH_INFO is blank in CF 10
                                      itisdesign MVP

                                      Hi Sue,

                                       

                                      Could you please also try getDirectoryFromPath(CGI.SCRIPT_NAME) ?

                                       

                                      Btw, I've updated my last post (explained in the comment at the bottom of it) in order to correctly clarify my points.  Sorry about the mistakes in my last post.

                                       

                                      Thanks,

                                      -Aaron

                                      • 16. Re: CGI.PATH_INFO is blank in CF 10
                                        itisdesign MVP

                                        Hi Anit,

                                         

                                        CF10 still returns CGI.PATH_INFO as CGI.SCRIPT_NAME when default document is omitted.

                                         

                                        Example: CGI.PATH_INFO for http://domain.com/dir/ is /dir/index.cfm

                                         

                                        However, getPageContext().getRequest().getPathInfo() is empty for the same.

                                         

                                        Thanks,

                                        -Aaron

                                        • 17. Re: CGI.PATH_INFO is blank in CF 10
                                          sduncanute Community Member
                                          home
                                          »  English
                                          »  sue.cfm


                                          testing CGI.SCRIPT_NAME is /English/sue.cfm
                                          CGI.PATH_INFO is
                                          getDirectoryFromPath(CGI.SCRIPT_NAME) /English/

                                          • 18. Re: CGI.PATH_INFO is blank in CF 10
                                            Anit_Kumar Adobe Employee

                                            Hi Aaron,

                                             

                                            This is an example set which you can try to see the functionality:-

                                             

                                            <cfoutput>

                                                      <h1>Test CGI Outputs</h1>

                                                                <div id="videogallery">

                                                                          Software: #CGI.SERVER_SOFTWARE#<br />

                                                                          ColdFusion Version: #server.ColdFusion.ProductVersion#<br />

                                                                          Path Info: #CGI.PATH_INFO#<br />

                                                                          Script Name: #CGI.SCRIPT_NAME#<br />

                                                                          Path Translated: #CGI.PATH_TRANSLATED#<br />

                                                                          <cfdump var="#CGI.PATH_INFO#">

                                                                </div>

                                            </cfoutput>

                                             

                                            Regards,

                                            Anit Kumar

                                            • 19. Re: CGI.PATH_INFO is blank in CF 10
                                              Adam Cameron. Community Member

                                              sduncanute wrote:

                                               

                                              I don't have ANY urls have have a /anything after the .cfm file so Anit, repeating your message over and over is not helpful, nor does it add anything to this thread.

                                               

                                               

                                              I think rather than getting snippy, you should perhaps actually read what Anit has been saying. They explained the situation perfectly well. The problem is that you're either not reading it, or not understanding it.

                                               

                                              I don't have ANY urls have have a /anything after the .cfm file

                                               

                                              Precisely. Given CGI.PATH_INFO is specifically for returning the stuff after the .cfm file, it stands to reason that it's empty if you don't have anything there.

                                               

                                              You need to understand that the behaviour on previous versions of ColdFusion - wherein CF supposedly put the file path (eg: /path/to/the/file.cfm) into CGI.PATH_INFO - was a bug. It was never supposed to be in there. CF10 fixed this.

                                               

                                              To try to repeat what Anit and Aaron have said, given this path:

                                               

                                              /physical/path/to/file/on/the/file/system.cfm/some/other/stuff?param=value

                                               

                                              • CGI.SCRIPT_NAME
                                              • CGI.PATH_INFO
                                              • CGI.QUERY_STRING

                                               

                                              That is how CF10 behaves, and that's how it's supposed to behave. This is correct behaviour.

                                               

                                              (that said, that's exactly how CF9.0.2 behaves for me as well).

                                               

                                              Does that make sense?

                                               

                                              And is this not what you too are seeing?

                                               

                                              --

                                              Adam

                                              • 20. Re: CGI.PATH_INFO is blank in CF 10
                                                itisdesign MVP

                                                Hi Anit,

                                                 

                                                I see CF10's CGI.PATH_INFO is still incorrect in IIS6 and IIS7 when URL does not contain a file name or extra path info, and when the directory contains a default document.

                                                 

                                                Steps to Reproduce:

                                                1) Place this code into C:\Inetpub\wwwroot\dir\index.cfm

                                                 

                                                <cfoutput>

                                                IIS: #CGI.SERVER_SOFTWARE#<br />

                                                Translated: #CGI.PATH_TRANSLATED#<br />

                                                Script: #CGI.SCRIPT_NAME#<br />

                                                Path Info CF: #CGI.PATH_INFO#<br />

                                                Path Info Java: #getPageContext().getRequest().getPathInfo()#

                                                </cfoutput>

                                                 

                                                2) Browse to URL http://localhost/dir/

                                                 

                                                3) See CF10's CGI.PATH_INFO is incorrect (/dir/index.cfm) in IIS6 and IIS7 and correct (empty string) in IIS7.5 and IIS8.

                                                 

                                                IIS: Microsoft-IIS/6.0

                                                Translated: C:\Inetpub\wwwroot\dir\index.cfm

                                                Script: /dir/index.cfm

                                                Path Info CF: /dir/index.cfm (bug?)

                                                Path Info Java:

                                                 

                                                IIS: Microsoft-IIS/7.0

                                                Translated: C:\inetpub\wwwroot\dir\index.cfm

                                                Script: /dir/index.cfm

                                                Path Info CF: /dir/index.cfm (bug?)

                                                Path Info Java:

                                                 

                                                IIS: Microsoft-IIS/7.5

                                                Translated: C:\inetpub\wwwroot\dir\index.cfm

                                                Script: /dir/index.cfm

                                                Path Info CF:

                                                Path Info Java:

                                                 

                                                IIS: Microsoft-IIS/8.0

                                                Translated: C:\inetpub\wwwroot\dir\index.cfm

                                                Script: /dir/index.cfm

                                                Path Info CF:

                                                Path Info Java:

                                                 

                                                I did not check the same on IIS5.1, so this should probably be verified as well since CF10 is also supported on IIS5.1.

                                                 

                                                Thanks,

                                                -Aaron

                                                • 21. Re: CGI.PATH_INFO is blank in CF 10
                                                  itisdesign MVP

                                                  Hi Sue,

                                                   

                                                  Looks like getDirectoryFromPath(CGI.SCRIPT_NAME) is what you want then, right?

                                                   

                                                  Thanks,

                                                  -Aaron

                                                  • 22. Re: CGI.PATH_INFO is blank in CF 10
                                                    itisdesign MVP

                                                    Excellent explanation, Adam   I think the color-coding did the trick nicely!

                                                    • 23. Re: CGI.PATH_INFO is blank in CF 10
                                                      sduncanute Community Member

                                                      Yes, Adam, the colour coding does help.  The problem is, I was dealing with a chunk of code that was written by someone else, years ago and it worked fine up until recently.

                                                       

                                                      Your colour coding shows that the CGI.PATH_INFO will no longer work for me and should not have worked before (but it has been since... 2004 or earlier).

                                                       

                                                      If I use getDirectoryFromPath(CGI.SCRIPT_NAME)  it gives me what I used to get from CGI.PATH_INFO.

                                                       

                                                      Sue

                                                      • 24. Re: CGI.PATH_INFO is blank in CF 10
                                                        itisdesign MVP

                                                        Updated: Added "And getPageContext().getRequest().getPathInfo() is always correct, regardless of IIS version."

                                                         

                                                        Hi Anit,

                                                         

                                                        Do you see the same?  Just want to verify before logging a bug.  Repro is simple..

                                                        itisdesign wrote:

                                                         

                                                        Hi Anit,

                                                         

                                                        I see CF10's CGI.PATH_INFO is still incorrect in IIS6 and IIS7 when URL does not contain a file name or extra path info, and when the directory contains a default document.

                                                         

                                                        Steps to Reproduce:

                                                        1) Place this code into C:\Inetpub\wwwroot\dir\index.cfm

                                                         

                                                        Btw, IIS7.5 and IIS8 are correct.  And getPageContext().getRequest().getPathInfo() is always correct, regardless of IIS version.

                                                         

                                                        Thanks!,

                                                        -Aaron

                                                         

                                                         

                                                        • 25. Re: CGI.PATH_INFO is blank in CF 10
                                                          Anit_Kumar Adobe Employee

                                                          Hi,

                                                           

                                                          The behavior of CGI.PATH_INFO attribute will remain the same irrespective of the version IIS with ColdFusion 10.

                                                           

                                                          And if you look at the screen shot below, the functionality is still the same in IIS8 as well for getPageContext().getRequest().getPathInfo().


                                                          itisdesign wrote:

                                                           

                                                          Updated: Added "And getPageContext().getRequest().getPathInfo() is always correct, regardless of IIS version."

                                                           

                                                          Thanks!,

                                                          -Aaron

                                                           

                                                           

                                                           

                                                          Untitled.jpg

                                                           

                                                          Regards,

                                                          Anit Kumar

                                                          • 26. Re: CGI.PATH_INFO is blank in CF 10
                                                            itisdesign MVP

                                                            Hi Anit,

                                                             

                                                            Sorry for the delay; I am on vacation.  Did you check IIS6 and IIS7?

                                                            Anit_Kumar wrote:

                                                            The behavior of CGI.PATH_INFO attribute will remain the same irrespective of the version IIS with ColdFusion 10.

                                                            20130403_CGIPathInfoWrongInIIS6.jpg

                                                            20130403_CGIPathInfoWrongInIIS7.jpg

                                                            IIS6:

                                                            - CGI.PATH_INFO: /dir/index.cfm

                                                            - getPageContext().getRequest().getPathInfo(): [empty string]

                                                             

                                                            IIS7:

                                                            - CGI.PATH_INFO: /dir/index.cfm

                                                            - getPageContext().getRequest().getPathInfo(): [empty string]

                                                             

                                                            IIS7.5:

                                                            - CGI.PATH_INFO: [empty string]

                                                            - getPageContext().getRequest().getPathInfo(): [empty string]

                                                             

                                                            IIS8:

                                                            - CGI.PATH_INO: [empty string]

                                                            - getPageContext().getRequest().getPathInfo(): [empty string]

                                                             

                                                            That is what I was trying to say.  Sorry if there was any confusion.  Should I log a bug for CF10's CGI.PATH_INFO in IIS6 & IIS7?

                                                             

                                                            Thanks!,

                                                            -Aaron

                                                            • 27. Re: CGI.PATH_INFO is blank in CF 10
                                                              henrylearn2rock Community Member

                                                              I'm also getting [empty string]

                                                               

                                                               

                                                              CF 10,0,11,285437

                                                               

                                                              Update Level /C:/ColdFusion10/cfusion/lib/updates/chf10000011.jar 

                                                               

                                                              IIS 7.5 w/ CF connector reinstalled

                                                              URL : http://localhost/test/test.cfm;lat=50;long=20;scale=32000

                                                              CGI.PATH_INFO: [empty string]

                                                              getPageContext().getRequest().getRequestUri() : /test/test.cfm;lat=50;long=20;scale=32000

                                                               

                                                              related quesiton: http://stackoverflow.com/questions/19253722/is-it-possible-to-access-the-matrix-parameters -name-value-pair-separated-by-sem