#146 Vars passed in via URL not quite right.

closed
Other (206)
5
2012-10-11
2002-10-01
Mike Poe
No

I've got AWStats set up on my win2k box (took less then
10 minutes, nice work), and I think it's pretty cool.
I've used the "at" command to schedule an update every
night (or morning, as the case may be) at 5AM using the
following LogFile setting:

LogFile="C:/WINNT/system32/LogFiles/W3SVC1/ex%YY-24%MM-24%DD-24.log"
(i.e. The example given in the comments.)

This works just fine, but I was thinking that at times,
I might also like to update with "up-to-the-moment"
info, so I thought I'd try using a URL like this:

http://mysite/cgi-bin/awstats.pl?config=myname&update=1&LogFile=C:/WINNT/system32/LogFiles/W3SVC1/ex%YY%MM%DD.log

And it almost works! The only problem is this error:

Error: Couldn't open server log file
"C:/WINNT/system32/LogFiles/W3SVC1/ex0210Ý.log" : No
such file or directory

The %DD seems to be substituted for Ý instead of the
day. If I manually type in "01" (for the 1st of the
month), it works just fine. It consistently
understands %YY and %MM, but not %DD. In fact, I can
modify the last parameter and it will give other
strange characters. Example:

http://ngd.myftp.org/cgi-bin/awstats.pl?config=curious&update=1&LogFile=C:/WINNT/system32/LogFiles/W3SVC1/ex%YY%MM%DA.log

yields:

Error: Couldn't open server log file
"C:/WINNT/system32/LogFiles/W3SVC1/ex0210Ú.log" : No
such file or directory

Notice that the %DA (Who knows that that's supposed to
be for) is converted to a Ú.

Anyway, I'm not sure if this is an intended feature to
pass in variables from the URL, but I thought it was at
least worth mentioning for two reasons:

  1. Maybe it's feature and could/should be fixed.
  2. Maybe this opens possible security issues, for
    example, what if someone sent a URL with LogFIle =
    c:\winnt\system32\cmd or some other weird file.

Anyway. Very cool program. The best I've seen so far
for free, and better than many that people pay for. :-)

-Mike

Discussion

  • Logged In: YES
    user_id=96898

    This is not a pb in awstats but in HTTP codage protocol.
    To send a % char in an URL you must send %25
    This give you :
    http://ngd.myftp.org/cgi-bin/awstats.pl?
    config=curious&update=1&LogFile=C:/WINNT/system32/LogFiles
    /W3SVC1/ex%25YY%25MM%25DD.log

     
  • Mike Poe
    Mike Poe
    2002-10-03

    Logged In: YES
    user_id=621594

    Ooooohhhhh... Thanks for the info. I wonder why the %YY and
    %MM worked. Weird. Oh well. Thanks, it works great the
    way you told me. :-)

    -Mike