Skip navigation
Currently Being Moderated

CGI.PATH_INFO is blank in CF 10

Feb 21, 2013 1:08 PM

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

 
Replies
  • Currently Being Moderated
    Feb 22, 2013 10:48 AM   in reply to ColdFusionSmurf

    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/HttpServlet Request.html#getPathInfo().

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 22, 2013 12:08 PM   in reply to ColdFusionSmurf

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

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 22, 2013 12:12 PM   in reply to ColdFusionSmurf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 22, 2013 10:31 PM   in reply to ColdFusionSmurf

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 11:02 AM   in reply to itisdesign

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 12:40 PM   in reply to sduncanute

    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/HttpServlet Request.html#getPathInfo().

     

    Regards,

    Anit Kumar

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 12:49 PM   in reply to Anit Kumar Panda

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 1:14 PM   in reply to sduncanute

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 1:18 PM   in reply to Anit Kumar Panda

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 13, 2013 3:06 PM   in reply to sduncanute

    Hello Sue,

     

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

     

    Regards,

    Anit Kumar

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 2:52 AM   in reply to sduncanute

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 14, 2013 12:20 PM   in reply to itisdesign

    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-s ept-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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 3:07 AM   in reply to sduncanute

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 3:23 AM   in reply to Anit Kumar Panda

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 5:47 AM   in reply to itisdesign
    home
    »  English
    »  sue.cfm


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

    
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 12:10 PM   in reply to itisdesign

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 1:43 PM   in reply to sduncanute

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 3:57 PM   in reply to Anit Kumar Panda

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 3:53 PM   in reply to sduncanute

    Hi Sue,

     

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

     

    Thanks,

    -Aaron

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 15, 2013 3:54 PM   in reply to Adam Cameron.

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

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2013 8:28 AM   in reply to Adam Cameron.

    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

    
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 27, 2013 10:35 PM   in reply to itisdesign

    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

     

     

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 29, 2013 11:08 AM   in reply to itisdesign

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Apr 3, 2013 1:59 AM   in reply to Anit Kumar Panda

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 8, 2013 1:04 PM   in reply to itisdesign

    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-t he-matrix-parameters-name-value-pair-separated-by-sem

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points