Cyrill Osterwalder posted a detailed analysis about a bug that occurs when
using a custom Host: header and curl fails to send a request on a re-used persistent connection and thus creates a new connection and resends it. It then sent two Host: headers. Cyrill's analysis was posted here: http://curl.haxx.se/mail/archive-2005-01/0022.html
This commit is contained in:
		
							
								
								
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								CHANGES
									
									
									
									
									
								
							| @@ -8,6 +8,12 @@ | |||||||
|  |  | ||||||
|  |  | ||||||
| Daniel (11 January 2005) | Daniel (11 January 2005) | ||||||
|  | - Cyrill Osterwalder posted a detailed analysis about a bug that occurs when | ||||||
|  |   using a custom Host: header and curl fails to send a request on a re-used | ||||||
|  |   persistent connection and thus creates a new connection and resends it. It | ||||||
|  |   then sent two Host: headers. Cyrill's analysis was posted here: | ||||||
|  |   http://curl.haxx.se/mail/archive-2005-01/0022.html | ||||||
|  |  | ||||||
| - Bruce Mitchener identified (bug report #1099640) the never-ending SOCKS5 | - Bruce Mitchener identified (bug report #1099640) the never-ending SOCKS5 | ||||||
|   problem with the version byte and the check for bad versions. Bruce has lots |   problem with the version byte and the check for bad versions. Bruce has lots | ||||||
|   of clues on this, and based on his suggestion I've now removed the check of |   of clues on this, and based on his suggestion I've now removed the check of | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ This release includes the following changes: | |||||||
|  |  | ||||||
| This release includes the following bugfixes: | This release includes the following bugfixes: | ||||||
|  |  | ||||||
|  |  o duplicate Host: when failed connection re-use | ||||||
|  o SOCKS5 version check |  o SOCKS5 version check | ||||||
|  o memory problem with cleaning up multi interface |  o memory problem with cleaning up multi interface | ||||||
|  o SSL certificate name memory leak |  o SSL certificate name memory leak | ||||||
| @@ -35,6 +36,6 @@ advice from friends like these: | |||||||
|  |  | ||||||
|  Dan Fandrich, Peter Pentchev, Marcin Konicki, Rune Kleveland, David Shaw, |  Dan Fandrich, Peter Pentchev, Marcin Konicki, Rune Kleveland, David Shaw, | ||||||
|  Werner Koch, Gisle Vanem, Alex Neblett, Kai Sommerfeld, Marty Kuhrt, |  Werner Koch, Gisle Vanem, Alex Neblett, Kai Sommerfeld, Marty Kuhrt, | ||||||
|  Hzhijun, Pavel Orehov, Bruce Mitchener |  Hzhijun, Pavel Orehov, Bruce Mitchener, Cyrill Osterwalder | ||||||
|  |  | ||||||
|         Thanks! (and sorry if I forgot to mention someone) |         Thanks! (and sorry if I forgot to mention someone) | ||||||
|   | |||||||
| @@ -342,7 +342,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) | |||||||
|           gotourl = strdup(easy->easy_handle->change.url); |           gotourl = strdup(easy->easy_handle->change.url); | ||||||
|           if(gotourl) { |           if(gotourl) { | ||||||
|             easy->easy_handle->change.url_changed = FALSE; |             easy->easy_handle->change.url_changed = FALSE; | ||||||
|             easy->result = Curl_follow(easy->easy_handle, gotourl); |             easy->result = Curl_follow(easy->easy_handle, gotourl, FALSE); | ||||||
|             if(CURLE_OK == easy->result) |             if(CURLE_OK == easy->result) | ||||||
|               easy->state = CURLM_STATE_CONNECT; |               easy->state = CURLM_STATE_CONNECT; | ||||||
|             else |             else | ||||||
| @@ -518,7 +518,7 @@ CURLMcode curl_multi_perform(CURLM *multi_handle, int *running_handles) | |||||||
|             easy->easy_conn->newurl = NULL; |             easy->easy_conn->newurl = NULL; | ||||||
|             easy->result = Curl_done(&easy->easy_conn, CURLE_OK); |             easy->result = Curl_done(&easy->easy_conn, CURLE_OK); | ||||||
|             if(easy->result == CURLE_OK) |             if(easy->result == CURLE_OK) | ||||||
|               easy->result = Curl_follow(easy->easy_handle, newurl); |               easy->result = Curl_follow(easy->easy_handle, newurl, FALSE); | ||||||
|             if(CURLE_OK == easy->result) { |             if(CURLE_OK == easy->result) { | ||||||
|               easy->state = CURLM_STATE_CONNECT; |               easy->state = CURLM_STATE_CONNECT; | ||||||
|               result = CURLM_CALL_MULTI_PERFORM; |               result = CURLM_CALL_MULTI_PERFORM; | ||||||
|   | |||||||
| @@ -1742,9 +1742,11 @@ static void strcpy_url(char *output, char *url) | |||||||
|  * as given by the remote server and set up the new URL to request. |  * as given by the remote server and set up the new URL to request. | ||||||
|  */ |  */ | ||||||
| CURLcode Curl_follow(struct SessionHandle *data, | CURLcode Curl_follow(struct SessionHandle *data, | ||||||
|                      char *newurl) /* this 'newurl' is the Location: string, |                      char *newurl, /* this 'newurl' is the Location: string, | ||||||
|                                       and it must be malloc()ed before passed |                                       and it must be malloc()ed before passed | ||||||
|                                       here */ |                                       here */ | ||||||
|  |                      bool retry) /* set TRUE if this is a request retry as | ||||||
|  |                                     opposed to a real redirect following */ | ||||||
| { | { | ||||||
|   /* Location: redirect */ |   /* Location: redirect */ | ||||||
|   char prot[16]; /* URL protocol string storage */ |   char prot[16]; /* URL protocol string storage */ | ||||||
| @@ -1758,6 +1760,7 @@ CURLcode Curl_follow(struct SessionHandle *data, | |||||||
|     return CURLE_TOO_MANY_REDIRECTS; |     return CURLE_TOO_MANY_REDIRECTS; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|  |   if(!retry) | ||||||
|     /* mark the next request as a followed location: */ |     /* mark the next request as a followed location: */ | ||||||
|     data->state.this_is_a_follow = TRUE; |     data->state.this_is_a_follow = TRUE; | ||||||
|  |  | ||||||
| @@ -2063,7 +2066,7 @@ Curl_connect_host(struct SessionHandle *data, | |||||||
|       res = Curl_done(conn, res); |       res = Curl_done(conn, res); | ||||||
|       if(CURLE_OK == res) { |       if(CURLE_OK == res) { | ||||||
|         char *gotourl = strdup(data->change.url); |         char *gotourl = strdup(data->change.url); | ||||||
|         res = Curl_follow(data, gotourl); |         res = Curl_follow(data, gotourl, FALSE); | ||||||
|         if(res) |         if(res) | ||||||
|           free(gotourl); |           free(gotourl); | ||||||
|       } |       } | ||||||
| @@ -2086,6 +2089,7 @@ CURLcode Curl_perform(struct SessionHandle *data) | |||||||
|   CURLcode res2; |   CURLcode res2; | ||||||
|   struct connectdata *conn=NULL; |   struct connectdata *conn=NULL; | ||||||
|   char *newurl = NULL; /* possibly a new URL to follow to! */ |   char *newurl = NULL; /* possibly a new URL to follow to! */ | ||||||
|  |   bool retry = FALSE; | ||||||
|  |  | ||||||
|   data->state.used_interface = Curl_if_easy; |   data->state.used_interface = Curl_if_easy; | ||||||
|  |  | ||||||
| @@ -2119,6 +2123,8 @@ CURLcode Curl_perform(struct SessionHandle *data) | |||||||
|         res = Transfer(conn); /* now fetch that URL please */ |         res = Transfer(conn); /* now fetch that URL please */ | ||||||
|         if(res == CURLE_OK) { |         if(res == CURLE_OK) { | ||||||
|  |  | ||||||
|  |           retry = FALSE; | ||||||
|  |  | ||||||
|           if((conn->keep.bytecount+conn->headerbytecount == 0) && |           if((conn->keep.bytecount+conn->headerbytecount == 0) && | ||||||
|              conn->bits.reuse) { |              conn->bits.reuse) { | ||||||
|             /* We got no data and we attempted to re-use a connection. This |             /* We got no data and we attempted to re-use a connection. This | ||||||
| @@ -2135,6 +2141,7 @@ CURLcode Curl_perform(struct SessionHandle *data) | |||||||
|                                         prevent i.e HTTP transfers to return |                                         prevent i.e HTTP transfers to return | ||||||
|                                         error just because nothing has been |                                         error just because nothing has been | ||||||
|                                         transfered! */ |                                         transfered! */ | ||||||
|  |             retry = TRUE; | ||||||
|           } |           } | ||||||
|           else |           else | ||||||
|             /* |             /* | ||||||
| @@ -2174,7 +2181,7 @@ CURLcode Curl_perform(struct SessionHandle *data) | |||||||
|        */ |        */ | ||||||
|  |  | ||||||
|       if((res == CURLE_OK) && newurl) { |       if((res == CURLE_OK) && newurl) { | ||||||
|         res = Curl_follow(data, newurl); |         res = Curl_follow(data, newurl, retry); | ||||||
|         if(CURLE_OK == res) { |         if(CURLE_OK == res) { | ||||||
|           newurl = NULL; |           newurl = NULL; | ||||||
|           continue; |           continue; | ||||||
|   | |||||||
| @@ -26,7 +26,7 @@ CURLcode Curl_perform(struct SessionHandle *data); | |||||||
| CURLcode Curl_pretransfer(struct SessionHandle *data); | CURLcode Curl_pretransfer(struct SessionHandle *data); | ||||||
| CURLcode Curl_pretransfersec(struct connectdata *conn); | CURLcode Curl_pretransfersec(struct connectdata *conn); | ||||||
| CURLcode Curl_posttransfer(struct SessionHandle *data); | CURLcode Curl_posttransfer(struct SessionHandle *data); | ||||||
| CURLcode Curl_follow(struct SessionHandle *data, char *newurl); | CURLcode Curl_follow(struct SessionHandle *data, char *newurl, bool retry); | ||||||
| CURLcode Curl_readwrite(struct connectdata *conn, bool *done); | CURLcode Curl_readwrite(struct connectdata *conn, bool *done); | ||||||
| void Curl_single_fdset(struct connectdata *conn, | void Curl_single_fdset(struct connectdata *conn, | ||||||
|                        fd_set *read_fd_set, |                        fd_set *read_fd_set, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Daniel Stenberg
					Daniel Stenberg