Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 21 Sep 2003 16:05:07 +0200
From:      Simon Barner <barner@in.tum.de>
To:        Gerald Pfeifer <gerald@FreeBSD.org>
Cc:        freebsd-ports-bugs@FreeBSD.org
Subject:   Re: ports/56725: [patch, non-maintainer] web/webredirect: Fix build with gcc 2.95.4
Message-ID:  <20030921140506.GA1815@zi025.glhnet.mhn.de>
In-Reply-To: <200309211225.h8LCPeZi013371@freefall.freebsd.org>
References:  <200309211225.h8LCPeZi013371@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help

Here is some more information, as requested via pm.

With my comment in ports/www/webredirect/work/webredirect-0.3/incu/incu/log.hh
I was referring to "Boring workaround..." comment from the author of the
program, and I assumed that the log output would be broken on FreeBSD
4.x (and gcc 2.95.x).

-----> log.hh <-----
  class Log : public std::ostringstream {
  public:
    Log(const LogGrade g = l_info) : grade(g) {
      using namespace std;
      if(grade < silence) setstate(ios::failbit);
      else (*this) << grade << ": ";
    }
    ~Log();

    static void addDevice(LogDevice* dev);
    static void setTreshold(LogGrade t) { silence = t; }
    /** Boring workaround ... Without this, the first thing to get appended to
     * the Log gets broken. */

    // Does not work with gcc 2.95.4, so people with have to live with
    // broken output :(
#if !defined (__GNUC__) || __GNUC__ > 2
    template<typename T>
    std::ostream& operator << (const T& t) {
      return *((std::ostream*)(this)) << t;
    }
#endif
-----> log.hh <-----

I tested the port on our lan, and the bug does not seem to occur:

zi025# webredirect -d -t http://thor

gives me the following output in /var/log/messages:

(I killed it and restarted webredirect several times and successfully
redirected from my own host `zi025' to our main server `thor'.

[...]
Sep 21 15:33:50 zi025 /kernel: cd9660: Joliet Extension (Level 3)
Sep 21 15:42:13 zi025 webredirect: INFO: Starting webredirect 0.0.0.0.80 to http://www.leo.org
Sep 21 15:44:54 zi025 webredirect: INFO: Starting webredirect 0.0.0.0.80 to http://www.leo.org/
Sep 21 15:44:54 zi025 webredirect: DEBUG: webredirect.cc:234: Main loop
Sep 21 15:45:59 zi025 webredirect: INFO: Starting webredirect 0.0.0.0.80 to http://thor
Sep 21 15:45:59 zi025 webredirect: DEBUG: webredirect.cc:234: Main loop
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:239: Select returned 1
Sep 21 15:46:27 zi025 webredirect: INFO: Got request from 10.151.4.25 on fd 5
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:234: Main loop
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:239: Select returned 1
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:51: Read 438 chars.
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "GET / HTTP/1.1"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:135: fd #5 requested /
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Host: zi025"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20030827 Galeon/1.3.9"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,video/x-mng,image/png,image/jpeg,image/gif;q=0.2,*/*;q=0.1"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Accept-Language: de,en;q=0.5"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Accept-Encoding: gzip, deflate, compress;q=0.9"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Accept-Charset: ISO-8859-15,utf-8;q=0.7,*;q=0.7"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Keep-Alive: 300"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says "Connection: keep-alive"
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:103: fd #5 says ""
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:90: Hang up on 5
Sep 21 15:46:27 zi025 webredirect: DEBUG: webredirect.cc:234: Main loop
Sep 21 15:48:46 zi025 webredirect: INFO: Starting webredirect 0.0.0.0.80 to http://thor
Sep 21 15:48:46 zi025 webredirect: DEBUG: webredirect.cc:234: Main loop
[...]

I hope, I provided enough information now, but if you still want to know
something, just drop me a note.

Regards,
 Simon



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030921140506.GA1815>