Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
curl.6521
curl-7.37.0-connect-ftps-via-proxy.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File curl-7.37.0-connect-ftps-via-proxy.patch of Package curl.6521
From b88f980a7437abc1159a1185c04d381347c8f5b1 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg <daniel@haxx.se> Date: Wed, 17 Jun 2015 00:30:06 +0200 Subject: [PATCH] FTP: do the HTTP CONNECT for data connection blocking ** WORK-AROUND ** The introduced non-blocking general behaviour for Curl_proxyCONNECT() didn't work for the data connection establishment unless it was very fast. The newly introduced function argument makes it operate in a more blocking manner, more like it used to work in the past. This blocking approach is only used when the FTP data connecting through HTTP proxy. Blocking like this is bad. A better fix would make it work more asynchronously. Bug: https://github.com/bagder/curl/issues/278 --- lib/ftp.c | 4 ++-- lib/http_proxy.c | 22 ++++++++++++++-------- lib/http_proxy.h | 5 +++-- 3 files changed, 19 insertions(+), 12 deletions(-) Index: curl-7.37.0/lib/ftp.c =================================================================== --- curl-7.37.0.orig/lib/ftp.c +++ curl-7.37.0/lib/ftp.c @@ -1873,7 +1873,7 @@ static CURLcode proxy_magic(struct conne memset(&http_proxy, 0, sizeof(http_proxy)); data->req.protop = &http_proxy; - result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport); + result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, newhost, newport, TRUE); data->req.protop = ftp_save; @@ -3627,7 +3627,7 @@ static CURLcode ftp_do_more(struct conne if(conn->tunnel_state[SECONDARYSOCKET] == TUNNEL_CONNECT) { /* As we're in TUNNEL_CONNECT state now, we know the proxy name and port aren't used so we blank their arguments. TODO: make this nicer */ - result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, NULL, 0); + result = Curl_proxyCONNECT(conn, SECONDARYSOCKET, NULL, 0, FALSE); return result; } Index: curl-7.37.0/lib/http_proxy.c =================================================================== --- curl-7.37.0.orig/lib/http_proxy.c +++ curl-7.37.0/lib/http_proxy.c @@ -71,7 +71,7 @@ CURLcode Curl_proxy_connect(struct conne conn->data->req.protop = &http_proxy; conn->bits.close = FALSE; result = Curl_proxyCONNECT(conn, FIRSTSOCKET, - conn->host.name, conn->remote_port); + conn->host.name, conn->remote_port, FALSE); conn->data->req.protop = prot_save; if(CURLE_OK != result) return result; @@ -87,12 +87,16 @@ CURLcode Curl_proxy_connect(struct conne * Curl_proxyCONNECT() requires that we're connected to a HTTP proxy. This * function will issue the necessary commands to get a seamless tunnel through * this proxy. After that, the socket can be used just as a normal socket. + * + * 'blocking' set to TRUE means that this function will do the entire CONNECT + * + response in a blocking fashion. Should be avoided! */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, int sockindex, const char *hostname, - int remote_port) + int remote_port, + bool blocking) { int subversion=0; struct SessionHandle *data=conn->data; @@ -224,9 +228,16 @@ CURLcode Curl_proxyCONNECT(struct connec conn->tunnel_state[sockindex] = TUNNEL_CONNECT; - /* now we've issued the CONNECT and we're waiting to hear back, return - and get called again polling-style */ - return CURLE_OK; + + if(!blocking) { + if(0 == Curl_socket_ready(tunnelsocket, CURL_SOCKET_BAD, 0)) + /* return so we'll be called again polling-style */ + return CURLE_OK; + else { + DEBUGF(infof(data, + "Read response immediately from proxy CONNECT\n")); + } + } } /* END CONNECT PHASE */ Index: curl-7.37.0/lib/http_proxy.h =================================================================== --- curl-7.37.0.orig/lib/http_proxy.h +++ curl-7.37.0/lib/http_proxy.h @@ -7,7 +7,7 @@ * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * - * Copyright (C) 1998 - 2014, Daniel Stenberg, <daniel@haxx.se>, et al. + * Copyright (C) 1998 - 2015, Daniel Stenberg, <daniel@haxx.se>, et al. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms @@ -26,7 +26,8 @@ /* ftp can use this as well */ CURLcode Curl_proxyCONNECT(struct connectdata *conn, int tunnelsocket, - const char *hostname, int remote_port); + const char *hostname, int remote_port, + bool blocking); /* Default proxy timeout in milliseconds */ #define PROXY_TIMEOUT (3600*1000) @@ -34,7 +35,7 @@ CURLcode Curl_proxyCONNECT(struct connec CURLcode Curl_proxy_connect(struct connectdata *conn); #else -#define Curl_proxyCONNECT(x,y,z,w) CURLE_NOT_BUILT_IN +#define Curl_proxyCONNECT(x,y,z,w,v) CURLE_NOT_BUILT_IN #define Curl_proxy_connect(x) CURLE_OK #endif
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor