diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-30 14:46:12 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2015-01-30 14:46:12 +0200 |
commit | 47123239e481774e82e3e8fe01c5834b58eac40d (patch) | |
tree | 6ff06c818fd2d4f43bccd2c17ff7b148be72ad17 | |
parent | 975cc477e35eca3d63398a397206b0015646fd92 (diff) | |
download | vmod-basicauth-47123239e481774e82e3e8fe01c5834b58eac40d.tar.gz vmod-basicauth-47123239e481774e82e3e8fe01c5834b58eac40d.tar.bz2 |
Update manpage
-rw-r--r-- | src/vmod-basicauth.3 | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/src/vmod-basicauth.3 b/src/vmod-basicauth.3 index 883410e..4722525 100644 --- a/src/vmod-basicauth.3 +++ b/src/vmod-basicauth.3 @@ -1,8 +1,8 @@ .\" This file is part of Vmod-basicauth -*- nroff -*- -.\" Copyright (C) 2013-2014 Sergey Poznyakoff +.\" Copyright (C) 2013-2015 Sergey Poznyakoff .\" .\" Vmod-basicauth is free software; you can redistribute it and/or modify .\" it under the terms of the GNU General Public License as published by .\" the Free Software Foundation; either version 3, or (at your option) .\" any later version. .\" @@ -10,22 +10,22 @@ .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public License .\" along with vmod-basicauth. If not, see <http://www.gnu.org/licenses/>. -.TH VMOD-BASICAUTH 1 "November 10, 2014" "VMOD-BASICAUTH" "User Reference" +.TH VMOD-BASICAUTH 1 "January 30, 2015" "VMOD-BASICAUTH" "User Reference" .SH NAME vmod-basicauth \- Basic HTTP authentication .SH SYNOPSIS .B import basicauth; .BI "BOOL basicauth.match(STRING " passfile ", STRING " authstr ); .SH DESCRIPTION The -.B vmod-basicauth +.B vmod\-basicauth module implements basic HTTP authentication against the password file created using the .BR htpasswd (1) command. .PP Four kinds of password hashes are supported: @@ -40,22 +40,42 @@ supplies the name of the password file to use. The \fIauthstr\fR argument is the authentication string (normally, the value of the \fBAuthorization\fR HTTP header. .PP .SS Example: VCL 3.0 .PP .EX -if (!basicauth.match("/var/www/.htpasswd", req.http.Authorization)) { - error 401 "Restricted"; +sub vcl_recv { + if (!basicauth.match("/var/www/.htpasswd", + req.http.Authorization)) { + error 401 "Restricted"; + } } + +sub vcl_error { + if (obj.status == 401) { + set obj.http.WWW-Authenticate = + {"Basic realm="Restricted area""}; + } +} .EE .SS Example: VCL 4.0 .PP .EX -if (!basicauth.match("/var/www/.htpasswd", req.http.Authorization)) { - return (synth(401, "Restricted")); +sub vcl_recv { + if (!basicauth.match("/var/www/.htpasswd", + req.http.Authorization)) { + return (synth(401, "Restricted")); + } } + +sub vcl_synth { + if (resp.status == 401) { + set resp.http.WWW-Authenticate = + {"Basic realm="Restricted area""}; + } +} .EE .\" The MANCGI variable is set by man.cgi script on Ulysses. .\" The download.inc file contains the default DOWNLOAD section .\" for man-based doc pages. .if "\V[MANCGI]"WEBDOC" \{\ . ds package vmod-basicauth @@ -67,13 +87,13 @@ if (!basicauth.match("/var/www/.htpasswd", req.http.Authorization)) { .BR varnishd (1). .SH AUTHORS Sergey Poznyakoff .SH "BUG REPORTS" Report bugs to <gray@gnu.org>. .SH COPYRIGHT -Copyright \(co 2013-2014 Sergey Poznyakoff +Copyright \(co 2013-2015 Sergey Poznyakoff .br .na License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> .br .ad This is free software: you are free to change and redistribute it. |