}
if (ap_proxy_doconnect(sock, (char *)(proxyhost ? proxyhost : host),
- proxyport ? proxyport : port, r) == -1) {
+ proxyport ? proxyport : port, r) != APR_SUCCESS) {
apr_close_socket(sock);
return ap_proxyerror(r, HTTP_INTERNAL_SERVER_ERROR,
apr_pstrcat(r->pool, "Could not connect to remote machine:<br>",
- strerror(errno), NULL));
+ proxyhost, NULL));
}
/* If we are connecting through a remote proxy, we need to pass
#endif /*_OSD_POSIX*/
}
- if (ap_proxy_doconnect(sock, host, port, r) == -1) {
+ if (ap_proxy_doconnect(sock, host, port, r) != APR_SUCCESS) {
apr_close_socket(sock);
return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(r->pool,
"Could not connect to remote machine: ",
- strerror(errno), NULL));
+ host, NULL));
}
f = ap_bcreate(p, B_RDWR);
ap_log_error(APLOG_MARK, APLOG_DEBUG|APLOG_NOERRNO, 0, NULL,
"FTP: contacting host %d.%d.%d.%d:%d",
h3, h2, h1, h0, pport);
- if (ap_proxy_doconnect(dsock, inet_ntoa(destaddr), pport, r) == -1) {
+/* scary */
+ if (ap_proxy_doconnect(dsock, inet_ntoa(destaddr), pport, r) == APR_SUCCESS) {
return ap_proxyerror(r, HTTP_BAD_GATEWAY,
apr_pstrcat(r->pool,
"Could not connect to remote machine: ",
- strerror(errno), NULL));
+ inet_ntoa(destaddr), NULL));
}
else {
pasvmode = 1;
char *desthost;
apr_socket_t *sock;
int i, len, backasswards, content_length = -1;
+ apr_status_t err;
apr_array_header_t *reqhdrs_arr;
apr_table_t *resp_hdrs = NULL;
apr_table_entry_t *reqhdrs;
#endif
if (proxyhost != NULL) {
- i = ap_proxy_doconnect(sock, (char *)proxyhost, proxyport, r);
+ err = ap_proxy_doconnect(sock, (char *)proxyhost, proxyport, r);
}
else {
- i = ap_proxy_doconnect(sock, (char *)desthost, destport, r);
+ err = ap_proxy_doconnect(sock, (char *)desthost, destport, r);
}
- if (i == -1) {
+ if (err != APR_SUCCESS) {
if (proxyhost != NULL)
return DECLINED; /* try again another way */
else
return ap_proxyerror(r, HTTP_BAD_GATEWAY, apr_pstrcat(r->pool,
"Could not connect to remote machine: ",
- strerror(errno), NULL));
+ desthost, NULL));
}
clear_connection(r->pool, r->headers_in); /* Strip connection-based headers */