Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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

  • Loading branch information...
commit e462803e750ad73d486f3ff7596d538661b0b964 1 parent 9cbc012
@kung-fu-tzu authored
View
14 js/tests/sendfile.js
@@ -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
1  run-tests
@@ -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
1  sendfile-2.txt
@@ -0,0 +1 @@
+aaabbbccc
View
1  sendfile-3.txt
@@ -0,0 +1 @@
+---the rest
Please sign in to comment.
Something went wrong with that request. Please try again.