Project

General

Profile

Bug #2655 » lighttpd-issue-2655-testing-notes.txt

tfischer, 2016-03-30 15:29

 
1
# specify install location for testing
2
PREFIX=/tmp/lighttpd
3

    
4
# get Glen Strauss lighttpd source code - use commit prior to code fix to verify defect exists
5
mkdir -p ~/projects/lighttpd
6
cd ~/projects/lighttpd
7
git clone https://github.com/gstrauss/lighttpd1.4.git
8
cd lighttpd1.4
9
git checkout dd33a35 # master at end of day 2016 03 26
10

    
11
# build
12
./autogen.sh && ./configure --prefix=$PREFIX  && make && make install
13

    
14
# get configuration files in place and adjust paths
15
CONFIG=$PREFIX/etc/lighttpd/lighttpd.conf
16
mkdir -p $PREFIX/etc/lighttpd $PREFIX/var/run $PREFIX/var/log/lighttpd $PREFIX/srv/www/htdocs $PREFIX/var/cache
17
cp -R doc/config/modules.conf doc/config/lighttpd.conf doc/config/conf.d $PREFIX/etc/lighttpd
18
sed --in-place=.bak -e "sI^\(var\..*= \"\)/I\1$PREFIX/Ig" -e "sI^server.port = 80Iserver.port = 8080I" $CONFIG
19

    
20
# fetch an index page to verify web server is configured properly
21
$PREFIX/sbin/lighttpd -v > $PREFIX/srv/www/htdocs/index.html
22
$PREFIX/sbin/lighttpd -D -f $CONFIG # cntl-C to stop webserver
23

    
24
# then browse to http://localhost:8080
25

    
26
# verify that master without patch fails test
27
# files from http://redmine.lighttpd.net/issues/2655
28
cp ../refetch-image.html $PREFIX/srv/www/htdocs
29
$PREFIX/sbin/lighttpd -f $LIGHTTPD_CONFIG
30
( cd .. ; ./alternate-images.sh $PREFIX/srv/www/htdocs ) # cntl-C to stop
31
killall lighttpd
32

    
33
# then browse to http://localhost:8080/refetch-image.html
34
# chrome stops update with browser console listing ERR_CONTENT_LENGTH_MISMATCH
35
# firefox keeps running the javascript when the error is encountered with
36
# browser console reporting image corrupt or truncated
37

    
38
# rebuild code to test with gstrauss fix on branch bug-2655-http_chunk-open-fstat
39
git checkout bug-2655-http_chunk-open-fstat
40
make && make install
41

    
42
# test with fix in place - http://localhost:8080/refetch-image.html
43
$PREFIX/sbin/lighttpd -f $LIGHTTPD_CONFIG
44
( cd .. ; ./alternate-images.sh $PREFIX/srv/www/htdocs ) # cntl-C to stop
45
killall lighttpd
46

    
47
=========================================================================================================
48
=========================================================================================================
49
=========================================================================================================
50
=========================================================================================================
51

    
52
File: refetch-image.html 
53

    
54
<!DOCTYPE html>
55
<html>
56
  <head>
57
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
58
<meta http-equiv="Cache-control" content="no-cache">
59
    <title>Demonstrate content-length issue when image being fetched is being updated</title>
60
  </head>
61
  <body>
62
<div id="video_image_div" >
63
  <img id="video_image" src="img.jpg" onload="delayed_refresh_video()" />
64
</div>
65
<script>
66

    
67
var preview_count = 0;
68
function refresh_video() {
69
     preview_count++;
70
     document.getElementById("video_image").src = "img.jpg?img=" + preview_count
71
 }
72
 function delayed_refresh_video() {
73
         setTimeout(refresh_video, 30);
74
 }
75

    
76
 console.log("Starting repeated fetch of img.jpg file")
77
 refresh_video();
78
 </script>
79

    
80
</body>
81
</html>
82

    
83
=========================================================================================================
84
=========================================================================================================
85
=========================================================================================================
86
=========================================================================================================
87

    
88
File: alternate-images.sh
89

    
90
#!/bin/sh
91

    
92
HTDOCS=/tmp/lighttpd/www/htdocs
93

    
94
if [ -n "$1" ] ; then
95
   HTDOCS=$1
96
fi
97

    
98
while true ; do
99
   cp img1.jpg $HTDOCS
100
   mv $HTDOCS/img1.jpg $HTDOCS/img.jpg
101
   sleep 0.005
102
   cp img2.jpg $HTDOCS
103
   mv $HTDOCS/img2.jpg $HTDOCS/img.jpg
104
   sleep 0.005
105
done
(2-2/2)