Permalink
Browse files

real tests for sendfile – no more sending /etc/passwd ;)

  • Loading branch information...
1 parent 9cbc012 commit e462803e750ad73d486f3ff7596d538661b0b964 @peter-leonov committed May 18, 2010
Showing with 10 additions and 7 deletions.
  1. +7 −7 js/tests/sendfile.js
  2. +1 −0 run-tests
  3. +1 −0 sendfile-2.txt
  4. +1 −0 sendfile-3.txt
View
@@ -8,7 +8,7 @@ NginxTests.sendfile = function (r)
{
function callback (sr, body, rc)
{
- t.ok(body, 'response body')
+ t.eq(body, 'before:ha-ha, sendme!:abbbc:the rest:after', 'response body')
t.done()
}
@@ -31,16 +31,16 @@ NginxTests.sendfileHandler = function (r)
r.sendHttpHeader('text/plain; charset=utf-8')
r.flush()
- // all these four commants add just a specific buffer to the output chain
- // r.sendfile('/etc/passwd')
+ // all these commants just add a specific buffer to the output chain
r.print('before:')
- r.flush()
-
r.sendfile(Nginx.prefix + 'sendfile-1.txt')
-
+ r.print(':')
+ r.sendfile(Nginx.prefix + 'sendfile-2.txt', 2, 5)
+ r.print(':')
+ r.sendfile(Nginx.prefix + 'sendfile-3.txt', 3)
r.print(':after')
- r.flush()
+ r.flush()
r.sendSpecial(Nginx.HTTP_LAST)
return Nginx.OK
View
@@ -61,6 +61,7 @@ curl $OPTS "http://127.0.0.1:19090/run/standart-classes"
curl $OPTS "http://127.0.0.1:19090/run/subrequests"
curl $OPTS "http://127.0.0.1:19090/run/subrequest-headers-out"
curl $OPTS "http://127.0.0.1:19090/run/subrequest-headers-in"
+curl $OPTS "http://127.0.0.1:19090/run/sendfile"
curl $OPTS "http://127.0.0.1:19090/demo/request-headers-out"
curl $OPTS "http://127.0.0.1:19090/demo/delayed-output"
View
@@ -0,0 +1 @@
+aaabbbccc
View
@@ -0,0 +1 @@
+---the rest

0 comments on commit e462803

Please sign in to comment.