File tree 3 files changed +16
-13
lines changed
3 files changed +16
-13
lines changed Original file line number Diff line number Diff line change @@ -394,8 +394,10 @@ http_send_response(int fd, struct request *r)
394
394
for (i = 0 ; i < s .map_len ; i ++ ) {
395
395
len = strlen (s .map [i ].from );
396
396
if (!strncmp (realtarget , s .map [i ].from , len )) {
397
- /* match canonical host if vhosts are enabled */
398
- if (s .vhost && strcmp (s .map [i ].chost , vhostmatch )) {
397
+ /* match canonical host if vhosts are enabled and
398
+ * the mapping specifies a canonical host */
399
+ if (s .vhost && s .map [i ].chost &&
400
+ strcmp (s .map [i ].chost , vhostmatch )) {
399
401
continue ;
400
402
}
401
403
Original file line number Diff line number Diff line change @@ -155,10 +155,12 @@ main(int argc, char *argv[])
155
155
sizeof (struct map )))) {
156
156
die ("reallocarray:" );
157
157
}
158
- if (!(s .map [s .map_len - 1 ].chost = strtok (tok , " " )) ||
159
- !(s .map [s .map_len - 1 ].from = strtok (NULL , " " )) ||
160
- !(s .map [s .map_len - 1 ].to = strtok (NULL , " " )) ||
161
- strtok (NULL , "" )) {
158
+ if (!(s .map [s .map_len - 1 ].from = strtok (tok , " " )) ||
159
+ !(s .map [s .map_len - 1 ].to = strtok (NULL , " " ))) {
160
+ usage ();
161
+ }
162
+ s .map [s .map_len - 1 ].chost = strtok (NULL , " " );
163
+ if (strtok (NULL , "" )) {
162
164
usage ();
163
165
}
164
166
break ;
Original file line number Diff line number Diff line change 1
- .Dd 2019-02-18
1
+ .Dd 2019-02-24
2
2
.Dt QUARK 1
3
3
.Os suckless.org
4
4
.Sh NAME
@@ -57,16 +57,15 @@ Enable directory listing.
57
57
Add the target prefix mapping rule specified by
58
58
.Ar map ,
59
59
which has the form
60
- .Qq Pa chost from to ,
60
+ .Qq Pa from to [chost] ,
61
61
where each element is separated with whitespace.
62
62
.Pp
63
63
The prefix
64
64
.Pa from
65
- of all matching targets, especially only of those requests for the canonical
66
- virtual host
67
- .Pa chost
68
- when virtual hosts are specified, is then replaced with
69
- .Pa to .
65
+ of all matching targets is replaced with
66
+ .Pa to ,
67
+ optionally limited to the canonical virtual host
68
+ .Pa chost .
70
69
If no virtual hosts are given,
71
70
.Pa chost
72
71
is ignored.
You can’t perform that action at this time.
0 commit comments