webfs: change %H (hostname) format to %N to not collide with encodefmt's %H (hex)

This commit is contained in:
cinap_lenrek 2016-04-15 23:54:00 +02:00
parent 9e08127ba6
commit 1628c97d1e
4 changed files with 9 additions and 7 deletions

View file

@ -14,9 +14,10 @@ char* unquote(char *s, char **ps);
/* url */
#pragma varargck type "U" Url*
#pragma varargck type "E" Str2
#pragma varargck type "N" char*
int Efmt(Fmt*);
int Hfmt(Fmt*);
int Nfmt(Fmt*);
int Ufmt(Fmt*);
char* Upath(Url *);
Url* url(char *s, Url *b);

View file

@ -418,7 +418,7 @@ fsopen(Req *r)
*/
if(u = url("/", cl->url)){
if(r = u->host){
u->host = smprint("%H", r);
u->host = smprint("%N", r);
free(r);
}
@ -792,9 +792,10 @@ main(int argc, char *argv[])
quotefmtinstall();
fmtinstall('U', Ufmt);
fmtinstall('H', Hfmt);
fmtinstall('N', Nfmt);
fmtinstall('E', Efmt);
fmtinstall('[', encodefmt);
fmtinstall('H', encodefmt);
mtpt = "/mnt/web";
user = getuser();

View file

@ -81,7 +81,7 @@ tlswrap(int fd, char *servername)
if(debug)
conn.trace = tlstrace;
if(servername != nil)
conn.serverName = smprint("%H", servername);
conn.serverName = smprint("%N", servername);
if((fd = tlsClient(fd, &conn)) < 0){
if(debug) fprint(2, "tlsClient: %r\n");
return -1;
@ -428,7 +428,7 @@ authenticate(Url *u, Url *ru, char *method, char *s)
fmtprint(&fmt, "Digest ");
fmtprint(&fmt, "username=\"%s\", ", ouser);
fmtprint(&fmt, "realm=\"%s\", ", realm);
fmtprint(&fmt, "host=\"%H\", ", u->host);
fmtprint(&fmt, "host=\"%N\", ", u->host);
fmtprint(&fmt, "uri=\"%U\", ", ru);
fmtprint(&fmt, "nonce=\"%s\", ", nonce);
fmtprint(&fmt, "response=\"%s\"", resp);
@ -608,7 +608,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
/* http requires ascii encoding of host */
free(host);
host = smprint("%H", u->host);
host = smprint("%N", u->host);
if(proxy && strcmp(u->scheme, "https") != 0){
ru = *u;

View file

@ -69,7 +69,7 @@ Efmt(Fmt *f)
}
int
Hfmt(Fmt *f)
Nfmt(Fmt *f)
{
char *d, *s;