1

I'm trying to set up MoinMoin as an office wiki on our Windows 2008 Server running Apache 2.2.17. Originally I thought everything was working fine, except for some reason images weren't displaying properly. As it turns out, all of my statically served content was getting truncated (up to 800 characters), and I'm trying to figure out why.

The error log doesn't show anything, and the access log says the files are delivered either 200 OK or 304 Unchanged.

All the dynamic content seems to display OK and untruncated, and I have a Django installation on the same server which is also working normally.

What might be causing this odd behaviour? A curious bit of math, which I think points to an encoding issue - for all of the text files, the number of characters missing is equal to the number of newline characters in the truncated version of the file. Changing the encoding on the file itself doesn't seem to help, but if I put all of the content onto one line, it comes through just fine. While that does seem to work around the issue, changing all of the files would be a bit crufty, and I couldn't guess how to do that with an image.

Addendum: Here is what I see on the client using Wireshark's follow TCP stream function. The main thing I notice is that the dynamic content (/bgcwiki) has a number of newlines followed by 0, while the static content doesn't always even have a newline. In particular, the .png doesn't have any whitespace between the end of its content and the next GET request.

GET /bgcwiki HTTP/1.1
Host: msdc2
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812

HTTP/1.1 404 NOT FOUND
Date: Thu, 12 Jan 2012 15:04:39 GMT
Server: Apache
Vary: Cookie,User-Agent,Accept-Language
Set-Cookie: MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812; expires=Sun, 09-Jan-2022 15:04:00 GMT; Max-Age=315360000; Path=/
Keep-Alive: timeout=5, max=99
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=utf-8

1386
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<meta name="edit_on_doubleclick" content="/bgcwiki">
<meta name="robots" content="index,nofollow">

<title>bgcwiki - Boys &amp; Girls Club of Thunder Bay</title>
<script type="text/javascript" src="/bgcwiki/moin_static193/common/js/common.js"></script>

<!-- snip -->

14
</body>
</html>


0

GET /bgcwiki/moin_static193/common/js/common.js HTTP/1.1
Host: msdc2
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Accept: */*
Referer: http://msdc2/bgcwiki
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812

HTTP/1.1 200 OK
Date: Thu, 12 Jan 2012 15:04:40 GMT
Server: Apache
Etag: "wzsdm-1326330976-29032-305726357"
Cache-Control: max-age=43200, public
Expires: Fri, 13 Jan 2012 03:04:40 GMT
Content-Length: 29032
Last-Modified: Wed, 11 Jan 2012 20:16:16 GMT
Keep-Alive: timeout=5, max=98
Connection: Keep-Alive
Content-Type: application/x-javascript

//
// MoinMoin commonly used JavaScript functions
//

/* snip */

runASAP(runScrollTextareaInitOnce);
// ensure init will be run by obsolete browsers
addLoadEvent(runScrollTextareaInitOnce);
GET /bgcwiki/moin_static193/smallbgclogo.png HTTP/1.1
Host: msdc2
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Accept: */*
Referer: http://msdc2/bgcwiki
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812

HTTP/1.1 200 OK
Date: Thu, 12 Jan 2012 15:04:40 GMT
Server: Apache
Etag: "wzsdm-1326230173-7814-930940522"
Cache-Control: max-age=43200, public
Expires: Fri, 13 Jan 2012 03:04:40 GMT
Content-Length: 7814
Last-Modified: Tue, 10 Jan 2012 16:16:13 GMT
Keep-Alive: timeout=5, max=97
Connection: Keep-Alive
Content-Type: image/png

.PNG

...
IHDR.......Z.............sRGB.........bKGD..............pHYs.................tIME...
..

/* snip */

...(Fg.1......(F1.Q.b....(F1.Q.b.......P.Yg[XB.....IEND.B`.GET /bgcwiki/moin_static193/modern/css/print.css HTTP/1.1
Host: msdc2
Connection: keep-alive
Cache-Control: no-cache
Pragma: no-cache
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.7 (KHTML, like Gecko) Chrome/16.0.912.63 Safari/535.7
Accept: text/css,*/*;q=0.1
Referer: http://msdc2/bgcwiki
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-GB,en-US;q=0.8,en;q=0.6
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: sessionid=6e2eaf00d5f8f22b576ed232d4f2fafb; csrftoken=8eb6a8ed71814c2c037532ed51cc2f81; MOIN_SESSION_80_ROOT_bgcwiki=95631c8ede11697138a37901afe53fc38b412812

HTTP/1.1 200 OK
Date: Thu, 12 Jan 2012 15:04:41 GMT
Server: Apache
Etag: "wzsdm-1277603206-811-309986213"
Cache-Control: max-age=43200, public
Expires: Fri, 13 Jan 2012 03:04:41 GMT
Content-Length: 811
Last-Modified: Sat, 26 Jun 2010 21:46:46 GMT
Keep-Alive: timeout=5, max=96
Connection: Keep-Alive
Content-Type: text/css

/*  print.css - MoinMoin Default Styles
Copyright (c) 2001, 2002, 2003 by Juergen Hermann
*/

/* snip */

#header, #sidebar, #footer, #timings, #credits, #interwiki, #pagelocation {
    display: none;
}

The Apache configuration file for MoinMoin (pretty standard?):

Alias /moin_static160/ "C:/Djangostack/python/Lib/site-packages/MoinMoin/web/static/htdocs/"
ScriptAlias /bgcwiki "C:/Djangostack/Moin/bgcwiki/moin.cgi"

<Directory 'C:/Djangostack/Moin/bgcwiki/' >
  Order allow,deny
  Allow from all
</Directory>
<Directory 'C:/Djangostack/python/Lib/site-packages/MoinMoin/web/static/htdocs/' >
  Order allow,deny
  Allow from all
</Directory>
10
  • 1
    Can you do a capture of the network traffic with a tool like wireshark? It's very strange for it to be that consistent. Jan 10, 2012 at 21:48
  • I take it I should try to capture outgoing traffic from the server? (as opposed to incoming to the client)
    – Hannele
    Jan 10, 2012 at 21:58
  • Both! Right-click one of the packets involved in the conversation and select "Follow TCP stream", which will give you the HTTP conversation in plain text. You'll also want to look at how the TCP session terminates; probably a RST packet. Data from the client or server might be interesting; inaccurate content lengths or compression settings, whether chunked encoding is in use (and whether the client has said it's ok with it).. it's hard to know what we're looking for until we narrow it down. Jan 10, 2012 at 22:09
  • The file leaves the server and gets to the client OK according to "Follow TCP stream", but it doesn't have any padding between the file and the next header like with the dynamically delivered HTML.
    – Hannele
    Jan 10, 2012 at 22:30
  • 1
    The zeros in the output are expected; notice that those responses contain Transfer-Encoding: chunked while the static responses contain a Content-Length header instead. Nor should there be a newline after the .png content finishes. Can you check the exact length, in bytes, of the returned data for the requests with the Content-Length header, and verify that it matches what's in the header? From what you have provided, it doesn't look like anything's missing.. Jan 12, 2012 at 17:13

2 Answers 2

1

Try setting EnableSendfile off and EnableMMAP off if you see static files truncated.

1
  • 1
    Thanks for the tip! Unfortunately, that didn't help.
    – Hannele
    Jan 12, 2012 at 15:55
1

It was, indeed, an encoding issue, and a configuration issue with MoinMoin, rather than Apache.

The problem was with the config file, not with any of the static files themselves. I suspect that due to editing an originally Unix-based file on a Windows machine, the encoding wasn't consistent across the whole file. My editor wouldn't even say what the encoding was!

After I converted the entire config file to Unicode (or, to anything consistent, really), everything starting working. Although, how that created this specific problem is a little beyond me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .