webfs: avoid retry loops when we got a bad key in factotum
This commit is contained in:
parent
038a615549
commit
c8d1a885f8
1 changed files with 10 additions and 3 deletions
|
@ -518,7 +518,7 @@ catch(void *, char *msg)
|
||||||
void
|
void
|
||||||
http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
|
http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
|
||||||
{
|
{
|
||||||
int i, l, n, try, pid, fd, cfd, needlength, chunked, retry, nobody;
|
int i, l, n, try, pid, fd, cfd, needlength, chunked, retry, nobody, badauth;
|
||||||
char *s, *x, buf[8192+2], status[256], method[16], *host;
|
char *s, *x, buf[8192+2], status[256], method[16], *host;
|
||||||
vlong length, offset;
|
vlong length, offset;
|
||||||
Url ru, tu, *nu;
|
Url ru, tu, *nu;
|
||||||
|
@ -560,6 +560,7 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
|
||||||
pid = 0;
|
pid = 0;
|
||||||
host = nil;
|
host = nil;
|
||||||
needlength = 0;
|
needlength = 0;
|
||||||
|
badauth = 0;
|
||||||
for(try = 0; try < 12; try++){
|
for(try = 0; try < 12; try++){
|
||||||
strcpy(status, "0 No status");
|
strcpy(status, "0 No status");
|
||||||
if(u == nil || (strcmp(u->scheme, "http") && strcmp(u->scheme, "https"))){
|
if(u == nil || (strcmp(u->scheme, "http") && strcmp(u->scheme, "https"))){
|
||||||
|
@ -864,8 +865,11 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
|
||||||
u = nu;
|
u = nu;
|
||||||
if(0){
|
if(0){
|
||||||
case 401: /* Unauthorized */
|
case 401: /* Unauthorized */
|
||||||
if(x = lookkey(shdr, "Authorization"))
|
if(x = lookkey(shdr, "Authorization")){
|
||||||
flushauth(nil, x);
|
flushauth(nil, x);
|
||||||
|
if(badauth++)
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
if(hauthenticate(u, &ru, method, "WWW-Authenticate", rhdr) < 0){
|
if(hauthenticate(u, &ru, method, "WWW-Authenticate", rhdr) < 0){
|
||||||
Autherror:
|
Autherror:
|
||||||
h->cancel = 1;
|
h->cancel = 1;
|
||||||
|
@ -879,8 +883,11 @@ http(char *m, Url *u, Key *shdr, Buq *qbody, Buq *qpost)
|
||||||
case 407: /* Proxy Auth */
|
case 407: /* Proxy Auth */
|
||||||
if(proxy == nil)
|
if(proxy == nil)
|
||||||
goto Error;
|
goto Error;
|
||||||
if(x = lookkey(shdr, "Proxy-Authorization"))
|
if(x = lookkey(shdr, "Proxy-Authorization")){
|
||||||
flushauth(proxy, x);
|
flushauth(proxy, x);
|
||||||
|
if(badauth++)
|
||||||
|
goto Error;
|
||||||
|
}
|
||||||
if(hauthenticate(proxy, proxy, method, "Proxy-Authenticate", rhdr) < 0)
|
if(hauthenticate(proxy, proxy, method, "Proxy-Authenticate", rhdr) < 0)
|
||||||
goto Autherror;
|
goto Autherror;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue