Summary: SquidPurgeClient fails on FreeBSD; incorrect constants
                    + MSG_EOR w/ SOCK_STREAM
           Product: MediaWiki
           Version: unspecified
          Platform: All
        OS/Version: FreeBSD
            Status: NEW
          Severity: normal
          Priority: Normal
         Component: General/Unknown

On FreeBSD, the new SquidPurgeClient fails to write to the socket it opens (and
thus fails to purge from the cache) for a couple of reasons:

* On FreeBSD, EAGAIN is 35, and EINPROGRESS is 36, which do not match the
(linux?) constants defined in SquidPurgeClient.php, thus causing getSocket() to
return false when it actually created the socket correctly:

* On FreeBSD, setting MSG_EOR on a SOCK_STREAM socket (as done in doWrites())
will result in EINVAL, so even if it gets the sockets, writing to them fails:;im=bigexcerpts#L378
I believe you are only meant to use MSG_EOR with SOCK_SEQPACKET.

Adjusting the constants to match those of FreeBSD and changing the $flags
parameter to 0 in doWrites fixed this problem for me on FreeBSD 8.1-RELEASE-p1.
Perhaps there's a better way to detect these platform-specific constants?


For what it's worth, I also added in a few more writes for Varnish, because it
won't purge gzip and deflate versions unless you ask. Not sure if it's required
for Squid (and there might be a better way to do this in VCL, too), but it was
much easier with the new architecture:

public function queuePurge( $url ) {
  $urlparts = parse_url(str_replace( "\n", '', $url ));
  $msg =  'PURGE ' . $urlparts['path'] . " HTTP/1.0\r\n" .
          'Host: ' . $urlparts['host'] . "\r\n".
          "Connection: Keep-Alive\r\n" .
          "Proxy-Connection: Keep-Alive\r\n" .
          'User-Agent: ' . Http::userAgent() . ' ' . __CLASS__ . "\r\n";
  $this->requests[] = $msg . "\r\n";
  $this->requests[] = $msg . "Accept-Encoding: gzip\r\n\r\n";
  $this->requests[] = $msg . "Accept-Encoding: deflate\r\n\r\n";

Configure bugmail:
------- You are receiving this mail because: -------
You are the assignee for the bug.
You are on the CC list for the bug.

Wikibugs-l mailing list

Reply via email to