- detect and return errors from neon through Ferror.
CVS patchset: 7619 CVS date: 2004/11/29 14:29:22
This commit is contained in:
parent
f5203aea8b
commit
15204958aa
1
CHANGES
1
CHANGES
|
@ -39,6 +39,7 @@
|
|||
- fix: chunked davRead returns 0 is EOF.
|
||||
- python: bleeping keywords broke labelCompare.
|
||||
- add support for automagic pubkey retrieval using HKP.
|
||||
- detect and return errors from neon through Ferror.
|
||||
|
||||
4.3.2 -> 4.3.3:
|
||||
- bump micro version.
|
||||
|
|
|
@ -20,7 +20,7 @@ Name: rpm
|
|||
%define version @VERSION@
|
||||
Version: %{version}
|
||||
%{expand: %%define rpm_version %{version}}
|
||||
Release: 0.8
|
||||
Release: 0.9
|
||||
Group: System Environment/Base
|
||||
Source: ftp://ftp.rpm.org/pub/rpm/dist/rpm-4.0.x/rpm-%{rpm_version}.tar.gz
|
||||
License: GPL
|
||||
|
@ -495,6 +495,9 @@ exit 0
|
|||
%{__includedir}/popt.h
|
||||
|
||||
%changelog
|
||||
* Mon Nov 29 2004 Jeff Johnson <jbj@jbj.org> 4.4-0.9
|
||||
- detect and return errors from neon through Ferror.
|
||||
|
||||
* Sun Nov 28 2004 Jeff Johnson <jbj@jbj.org> 4.4-0.8
|
||||
- add support for automagic pubkey retrieval using HKP.
|
||||
|
||||
|
|
|
@ -286,10 +286,6 @@ fprintf(stderr, "*** Connect to %s:%d failed(%d):\n\t%s\n",
|
|||
/* HACK: sensitive to error returns? */
|
||||
u->httpVersion = (ne_version_pre_http11(u->sess) ? 0 : 1);
|
||||
|
||||
/* HACK: stupid error impedence matching. */
|
||||
if (rc)
|
||||
rc = FTPERR_FAILED_CONNECT;
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
@ -322,10 +318,11 @@ static int davInit(const char * url, urlinfo * uret)
|
|||
/*@=noeffect@*/
|
||||
rc = ne_sock_init(); /* XXX oneshot? */
|
||||
|
||||
u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
|
||||
|
||||
u->capabilities = capabilities = xcalloc(1, sizeof(*capabilities));
|
||||
u->sess = ne_session_create(u->scheme, u->host, u->port);
|
||||
|
||||
u->lockstore = ne_lockstore_create(); /* XXX oneshot? */
|
||||
ne_lockstore_register(u->lockstore, u->sess);
|
||||
|
||||
if (u->proxyh != NULL)
|
||||
|
@ -794,27 +791,6 @@ exit:
|
|||
}
|
||||
|
||||
/* =============================================================== */
|
||||
/*@observer@*/
|
||||
static const char * my_retstrerror(int ret)
|
||||
/*@*/
|
||||
{
|
||||
const char * str = "NE_UNKNOWN";
|
||||
switch (ret) {
|
||||
case NE_OK: str = "NE_OK: Succeeded."; break;
|
||||
case NE_ERROR: str = "NE_ERROR: Generic error."; break;
|
||||
case NE_LOOKUP: str = "NE_LOOKUP: Hostname lookup failed."; break;
|
||||
case NE_AUTH: str = "NE_AUTH: Server authentication failed."; break;
|
||||
case NE_PROXYAUTH: str = "NE_PROXYAUTH: Proxy authentication failed.";break;
|
||||
case NE_CONNECT: str = "NE_CONNECT: Could not connect to server.";break;
|
||||
case NE_TIMEOUT: str = "NE_TIMEOUT: Connection timed out."; break;
|
||||
case NE_FAILED: str = "NE_FAILED: The precondition failed."; break;
|
||||
case NE_RETRY: str = "NE_RETRY: Retry request."; break;
|
||||
case NE_REDIRECT: str = "NE_REDIRECT: Redirect received."; break;
|
||||
default: str = "NE_UNKNOWN"; break;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
|
||||
/*@modifies *fp @*/
|
||||
{
|
||||
|
@ -825,10 +801,12 @@ static int my_result(const char * msg, int ret, /*@null@*/ FILE * fp)
|
|||
fp = stderr;
|
||||
if (msg != NULL)
|
||||
fprintf(fp, "*** %s: ", msg);
|
||||
|
||||
/* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
|
||||
#ifdef HACK
|
||||
fprintf(fp, "%s: %s\n", my_retstrerror(ret), ne_get_error(sess));
|
||||
fprintf(fp, "%s: %s\n", ftpStrerror(-ret), ne_get_error(sess));
|
||||
#else
|
||||
fprintf(fp, "%s\n", my_retstrerror(ret));
|
||||
fprintf(fp, "%s\n", ftpStrerror(-ret));
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
@ -903,25 +881,10 @@ int davResp(urlinfo u, FD_t ctrl, /*@unused@*/ char *const * str)
|
|||
if (_dav_debug < 0)
|
||||
fprintf(stderr, "*** davResp(%p,%p,%p) sess %p req %p rc %d\n", u, ctrl, str, u->sess, ctrl->req, rc);
|
||||
|
||||
/* HACK: stupid error impedence matching. */
|
||||
/* HACK: NE_TIMEOUT et al here does not unravel refcnt correctly. */
|
||||
switch (rc) {
|
||||
case NE_OK: rc = 0; break;
|
||||
case NE_ERROR: rc = FTPERR_SERVER_IO_ERROR; break;
|
||||
case NE_LOOKUP: rc = FTPERR_BAD_HOSTNAME; break;
|
||||
case NE_AUTH: rc = FTPERR_FAILED_CONNECT; break;
|
||||
case NE_PROXYAUTH: rc = FTPERR_FAILED_CONNECT; break;
|
||||
case NE_CONNECT: rc = FTPERR_FAILED_CONNECT; break;
|
||||
case NE_TIMEOUT: rc = FTPERR_SERVER_TIMEOUT; break;
|
||||
case NE_FAILED: rc = FTPERR_SERVER_IO_ERROR; break;
|
||||
case NE_RETRY: /* HACK: davReq handles. */ break;
|
||||
case NE_REDIRECT: rc = FTPERR_BAD_SERVER_RESPONSE;break;
|
||||
default: rc = FTPERR_UNKNOWN; break;
|
||||
}
|
||||
|
||||
/* HACK FTPERR_NE_FOO == -NE_FOO error impedance match */
|
||||
/*@-observertrans@*/
|
||||
if (rc)
|
||||
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
|
||||
fdSetSyserrno(ctrl, errno, ftpStrerror(-rc));
|
||||
/*@=observertrans@*/
|
||||
|
||||
return rc;
|
||||
|
@ -978,6 +941,7 @@ assert(ctrl->req != NULL);
|
|||
|
||||
/* HACK: other errors may need retry too. */
|
||||
/* HACK: neon retries once, gud enuf. */
|
||||
/* HACK: retry counter? */
|
||||
do {
|
||||
rc = davResp(u, ctrl, NULL);
|
||||
} while (rc == NE_RETRY);
|
||||
|
@ -996,6 +960,9 @@ errxit:
|
|||
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
|
||||
/*@=observertrans@*/
|
||||
|
||||
/* HACK balance fd refs. ne_session_destroy to tear down non-keepalive? */
|
||||
ctrl = fdLink(ctrl, "error data (davReq)");
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
|
@ -671,41 +671,52 @@ fprintf(stderr, "*** read: fd %p rc %d EOF errno %d %s \"%s\"\n", fd, rc, errno,
|
|||
/* =============================================================== */
|
||||
/* Support for FTP/HTTP I/O.
|
||||
*/
|
||||
const char *const ftpStrerror(int errorNumber) {
|
||||
const char *const ftpStrerror(int errorNumber)
|
||||
{
|
||||
switch (errorNumber) {
|
||||
case 0:
|
||||
return _("Success");
|
||||
|
||||
/* HACK error impediance match, coalesce and rename. */
|
||||
case FTPERR_NE_ERROR:
|
||||
return ("NE_ERROR: Generic error.");
|
||||
case FTPERR_NE_LOOKUP:
|
||||
return ("NE_LOOKUP: Hostname lookup failed.");
|
||||
case FTPERR_NE_AUTH:
|
||||
return ("NE_AUTH: Server authentication failed.");
|
||||
case FTPERR_NE_PROXYAUTH:
|
||||
return ("NE_PROXYAUTH: Proxy authentication failed.");
|
||||
case FTPERR_NE_CONNECT:
|
||||
return ("NE_CONNECT: Could not connect to server.");
|
||||
case FTPERR_NE_TIMEOUT:
|
||||
return ("NE_TIMEOUT: Connection timed out.");
|
||||
case FTPERR_NE_FAILED:
|
||||
return ("NE_FAILED: The precondition failed.");
|
||||
case FTPERR_NE_RETRY:
|
||||
return ("NE_RETRY: Retry request.");
|
||||
case FTPERR_NE_REDIRECT:
|
||||
return ("NE_REDIRECT: Redirect received.");
|
||||
|
||||
case FTPERR_BAD_SERVER_RESPONSE:
|
||||
return _("Bad server response");
|
||||
|
||||
case FTPERR_SERVER_IO_ERROR:
|
||||
return _("Server I/O error");
|
||||
|
||||
case FTPERR_SERVER_TIMEOUT:
|
||||
return _("Server timeout");
|
||||
|
||||
case FTPERR_BAD_HOST_ADDR:
|
||||
return _("Unable to lookup server host address");
|
||||
|
||||
case FTPERR_BAD_HOSTNAME:
|
||||
return _("Unable to lookup server host name");
|
||||
|
||||
case FTPERR_FAILED_CONNECT:
|
||||
return _("Failed to connect to server");
|
||||
|
||||
case FTPERR_FAILED_DATA_CONNECT:
|
||||
return _("Failed to establish data connection to server");
|
||||
|
||||
case FTPERR_FILE_IO_ERROR:
|
||||
return _("I/O error to local file");
|
||||
|
||||
case FTPERR_PASSIVE_ERROR:
|
||||
return _("Error setting remote server to passive mode");
|
||||
|
||||
case FTPERR_FILE_NOT_FOUND:
|
||||
return _("File not found on server");
|
||||
|
||||
case FTPERR_NIC_ABORT_IN_PROGRESS:
|
||||
return _("Abort in progress");
|
||||
|
||||
|
@ -3045,9 +3056,10 @@ int Ferror(FD_t fd)
|
|||
int i, rc = 0;
|
||||
|
||||
if (fd == NULL) return -1;
|
||||
if (fd->req != NULL)
|
||||
rc = 0; /* HACK: https has no steenkin errors. */
|
||||
else
|
||||
if (fd->req != NULL) {
|
||||
/* HACK: flimsy wiring for neon errors. */
|
||||
rc = (fd->syserrno || fd->errcookie != NULL) ? -1 : 0;
|
||||
} else
|
||||
for (i = fd->nfps; rc == 0 && i >= 0; i--) {
|
||||
/*@-boundsread@*/
|
||||
FDSTACK_t * fps = &fd->fps[i];
|
||||
|
|
|
@ -571,17 +571,27 @@ int rpmioMkpath(const char * path, mode_t mode, uid_t uid, gid_t gid)
|
|||
*/
|
||||
/*@-typeuse@*/
|
||||
typedef enum ftperrCode_e {
|
||||
FTPERR_BAD_SERVER_RESPONSE = -1, /*!< Bad server response */
|
||||
FTPERR_SERVER_IO_ERROR = -2, /*!< Server I/O error */
|
||||
FTPERR_SERVER_TIMEOUT = -3, /*!< Server timeout */
|
||||
FTPERR_BAD_HOST_ADDR = -4, /*!< Unable to lookup server host address */
|
||||
FTPERR_BAD_HOSTNAME = -5, /*!< Unable to lookup server host name */
|
||||
FTPERR_FAILED_CONNECT = -6, /*!< Failed to connect to server */
|
||||
FTPERR_FILE_IO_ERROR = -7, /*!< Failed to establish data connection to server */
|
||||
FTPERR_PASSIVE_ERROR = -8, /*!< I/O error to local file */
|
||||
FTPERR_FAILED_DATA_CONNECT = -9, /*!< Error setting remote server to passive mode */
|
||||
FTPERR_FILE_NOT_FOUND = -10, /*!< File not found on server */
|
||||
FTPERR_NIC_ABORT_IN_PROGRESS= -11, /*!< Abort in progress */
|
||||
FTPERR_NE_ERROR = -1, /*!< Generic error. */
|
||||
FTPERR_NE_LOOKUP = -2, /*!< Hostname lookup failed. */
|
||||
FTPERR_NE_AUTH = -3, /*!< Server authentication failed. */
|
||||
FTPERR_NE_PROXYAUTH = -4, /*!< Proxy authentication failed. */
|
||||
FTPERR_NE_CONNECT = -5, /*!< Could not connect to server. */
|
||||
FTPERR_NE_TIMEOUT = -6, /*!< Connection timed out. */
|
||||
FTPERR_NE_FAILED = -7, /*!< The precondition failed. */
|
||||
FTPERR_NE_RETRY = -8, /*!< Retry request. */
|
||||
FTPERR_NE_REDIRECT = -9, /*!< Redirect received. */
|
||||
|
||||
FTPERR_BAD_SERVER_RESPONSE = -81, /*!< Bad server response */
|
||||
FTPERR_SERVER_IO_ERROR = -82, /*!< Server I/O error */
|
||||
FTPERR_SERVER_TIMEOUT = -83, /*!< Server timeout */
|
||||
FTPERR_BAD_HOST_ADDR = -84, /*!< Unable to lookup server host address */
|
||||
FTPERR_BAD_HOSTNAME = -85, /*!< Unable to lookup server host name */
|
||||
FTPERR_FAILED_CONNECT = -86, /*!< Failed to connect to server */
|
||||
FTPERR_FILE_IO_ERROR = -87, /*!< Failed to establish data connection to server */
|
||||
FTPERR_PASSIVE_ERROR = -88, /*!< I/O error to local file */
|
||||
FTPERR_FAILED_DATA_CONNECT = -89, /*!< Error setting remote server to passive mode */
|
||||
FTPERR_FILE_NOT_FOUND = -90, /*!< File not found on server */
|
||||
FTPERR_NIC_ABORT_IN_PROGRESS= -91, /*!< Abort in progress */
|
||||
FTPERR_UNKNOWN = -100 /*!< Unknown or unexpected error */
|
||||
} ftperrCode;
|
||||
/*@=typeuse@*/
|
||||
|
|
Loading…
Reference in New Issue