Bug 2704 - id->raw_url confusion
: id->raw_url confusion
Status: NEW
: Roxen WebServer
Core
: 2.4
: All Other
: P3 (normal) normal
: ---
Assigned To:
:
:
:
  Show dependency treegraph
 
Reported: 2002-01-23 18:43 CET by
Modified: 2002-01-23 18:49 CET (History)
Scrum Prio:
In scrum?: ---
Story included in sprints:
Unplanned in sprints:


Attachments


Description From 2002-01-23 18:43:13 CET
There are discrepancies in the usage of id->raw_url in configurations that
aren't mounted on /. Its documentation states:

  string raw_url;
  //! The nonparsed, nontouched, non-* URL requested by the client.
  //! Hence, this path is unlike <ref>not_query</ref> and
  //! <ref>virtfile</ref> not relative to the server URL and must be
  //! used in conjunction with the former to generate absolute paths
  //! within the server. Be aware that this string will contain any
  //! URL variables present in the request as well as the file path.

It's not completely clear, but I interpret this as follows: If
"http://datan/foo/bar.html" is requested and the configuration port is
"http://*/foo", it will contain "/foo/bar.html" and not "/bar.html".

However, the code in protocols/http.pike specifically strips the
configuration path prefix from it (as well as from id->not_query).

Then again, some modules use id->raw_url to generate an absolute url, e.g.
foldlist.pike:

  string global_not_query=id->raw_url;
  sscanf(global_not_query, "%s?", global_not_query);

  return global_not_query+"?__state="+
    state->uri_encode(value);

This will generate urls to "/bar.html" when <foldlist> is used in the
example page above.

So the question is: Is the bug in protocols.pike or in foldlist.pike (and
probably other modules)? In either case, the docstring for raw_url should
be clarified.

(The problem also exist in 2.1 and 2.2.)
------- Comment #1 From 2002-01-23 18:50:02 CET -------
It's worth noting that the code in foldlist came about as a fix for the server
url stripping made in id->not_query:

lister:~/Roxen/devel/server/modules/tags> cvs log foldlist.pike
/.../
revision 1.22
date: 2000/08/15 23:08:50;  author: nilsson;  state: Exp;  lines: +5 -2
Now also works when using a virtual server mounted in another virtual server
/.../
lister:~/Roxen/devel/server/modules/tags> cvs diff -ur 1.21 -r 1.22
foldlist.pike
Index: foldlist.pike
===================================================================
RCS file: /cvs/Roxen/2.4/server/modules/tags/foldlist.pike,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -r1.21 -r1.22
--- foldlist.pike       2000/05/03 14:47:12     1.21
+++ foldlist.pike       2000/08/15 23:08:50     1.22
@@ -1,7 +1,7 @@
 // This is a roxen module. Copyright © 1999-2000, Roxen IS.
 //

-constant cvs_version = "$Id: foldlist.pike,v 1.21 2000/05/03 14:47:12 nilsson
Exp $";
+constant cvs_version = "$Id: foldlist.pike,v 1.22 2000/08/15 23:08:50 nilsson
Exp $";
 constant thread_safe=1;

 #include <module.h>
@@ -82,7 +82,10 @@
   //    return id->not_query+"?"+id->query+"&state="+
   //      state->uri_encode(value);

-  return id->not_query+"?state="+
+  string global_not_query=id->raw_url;
+  sscanf(global_not_query, "%s?", global_not_query);
+
+  return global_not_query+"?state="+
     state->uri_encode(value);
 }

That indicates either that id->raw_url wasn't modified when this change was
made, or that Nilsson didn't test the fix.

Btw, [bug 2247] and [bug 2702] are a bit related to this one.

Note

You need to log in before you can comment on or make changes to this bug.