diff options
author | Stef Walter <stef@memberwebs.com> | 2004-07-06 19:53:55 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2004-07-06 19:53:55 +0000 |
commit | b70e2d0ef64738561685072f01f7b3181fc89c69 (patch) | |
tree | 1697e03ae1c2df1cb5e066675ca63fe156f694fa /apache1x | |
parent | 4635412b630ce99a9ea5182a07c322162e9592fe (diff) |
- Nicer reconnect support
- Fixed other small bugs
Diffstat (limited to 'apache1x')
-rw-r--r-- | apache1x/mod_httpauth.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/apache1x/mod_httpauth.c b/apache1x/mod_httpauth.c index 91e6288..4b1abe6 100644 --- a/apache1x/mod_httpauth.c +++ b/apache1x/mod_httpauth.c @@ -141,7 +141,7 @@ void read_junk(httpauth_context_t* ctx, request_rec* r) break; buf[l] = 0; - t = trim_start(t); + t = trim_start(buf); if(!said && *t) { @@ -651,6 +651,7 @@ static int httpauth_authenticate(request_rec* r) int ccode = 0; char* details = NULL; request_rec* mainreq; + int retried = 0; /* Make sure it's for us */ if(!(authtype = ap_auth_type(r)) || strcasecmp(HTTPAUTH_AUTHTYPE, authtype) != 0) @@ -674,6 +675,9 @@ static int httpauth_authenticate(request_rec* r) if(ap_get_module_config(mainreq->request_config, &httpauth_module)) return OK; +/* For jumping to when a connection has been closed */ +retry: + if(ctx->socket == -1) { if(connect_httpauth(ctx, r) == -1) @@ -685,7 +689,22 @@ static int httpauth_authenticate(request_rec* r) /* Send off a request */ if(write_request(ctx, r) == -1) + { + /* + * If our connection was closed by httpauthd then this + * is where we get the error. Just do one retry to + * try and reconnect. This happens often when restarting + * httpauthd. + */ + + if(ctx->socket == -1 && !retried) + { + retried = 1; + goto retry; + } + return SERVER_ERROR; + } /* Read a response line */ if(read_response(ctx, r, &code, &ccode, &details) == -1) |