Skip to content

Commit

Permalink
Report reason for 'service unavailable' results from server
Browse files Browse the repository at this point in the history
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Nov 4, 2008
1 parent ed13012 commit 51a388d
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion cstp.c
Expand Up @@ -120,12 +120,24 @@ static int start_cstp_connection(struct openconnect_info *vpninfo)
}

if (strncmp(buf, "HTTP/1.1 200 ", 13)) {
if (!strncmp(buf, "HTTP/1.1 503 ", 13)) {
/* "Service Unavailable. Why? */
char *reason = "<unknown>";
while ((i=openconnect_SSL_gets(vpninfo->https_ssl, buf, sizeof(buf)))) {
if (!strncmp(buf, "X-Reason: ", 10)) {
reason = buf + 10;
break;
}
}
vpninfo->progress(vpninfo, PRG_ERR, "VPN service unavailable; reason: %s\n",
reason);
return -EINVAL;
}
vpninfo->progress(vpninfo, PRG_ERR,
"Got inappropriate HTTP CONNECT response: %s\n",
buf);
if (!strncmp(buf, "HTTP/1.1 401 ", 13))
exit(2);
openconnect_SSL_gets(vpninfo->https_ssl, buf, 65536);
return -EINVAL;
}

Expand Down

0 comments on commit 51a388d

Please sign in to comment.