summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/check_curl.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/plugins/check_curl.c b/plugins/check_curl.c
index 72db27ad..3ae1c4d0 100644
--- a/plugins/check_curl.c
+++ b/plugins/check_curl.c
@@ -551,7 +551,7 @@ check_http (void)
551 CURLINFO_REDIRECT_COUNT: get the number of redirects, print it, maybe a range option here is nice like for expected page size? 551 CURLINFO_REDIRECT_COUNT: get the number of redirects, print it, maybe a range option here is nice like for expected page size?
552 */ 552 */
553 } else { 553 } else {
554 // old style redirection is handled below 554 /* old style redirection is handled below */
555 } 555 }
556 } 556 }
557 557
@@ -1019,6 +1019,8 @@ redir (curlhelp_write_curlbuf* header_buf)
1019 new_host = strdup (uri_string (uri.hostText, buf, DEFAULT_BUFFER_SIZE)); 1019 new_host = strdup (uri_string (uri.hostText, buf, DEFAULT_BUFFER_SIZE));
1020 } 1020 }
1021 1021
1022 /* compose new path */
1023 /* TODO: handle fragments and query part of URL */
1022 new_url = (char *)calloc( 1, DEFAULT_BUFFER_SIZE); 1024 new_url = (char *)calloc( 1, DEFAULT_BUFFER_SIZE);
1023 if (uri.pathHead) { 1025 if (uri.pathHead) {
1024 const UriPathSegmentA* p = uri.pathHead; 1026 const UriPathSegmentA* p = uri.pathHead;
@@ -1038,23 +1040,21 @@ redir (curlhelp_write_curlbuf* header_buf)
1038 1040
1039 /* set new values for redirected request */ 1041 /* set new values for redirected request */
1040 1042
1041 free (host_name);
1042 host_name = strndup (new_host, MAX_IPV4_HOSTLENGTH);
1043 free(new_host);
1044
1045 server_port = (unsigned short)new_port;
1046
1047 /* reset virtual port */
1048 virtual_port = server_port;
1049
1050 if (!(followsticky & STICKY_HOST)) { 1043 if (!(followsticky & STICKY_HOST)) {
1051 free (server_address); 1044 free (server_address);
1052 server_address = strndup (new_host, MAX_IPV4_HOSTLENGTH); 1045 server_address = strndup (new_host, MAX_IPV4_HOSTLENGTH);
1053 } 1046 }
1054 if (!(followsticky & STICKY_PORT)) { 1047 if (!(followsticky & STICKY_PORT)) {
1055 server_port = new_port; 1048 server_port = (unsigned short)new_port;
1056 } 1049 }
1057 1050
1051 free (host_name);
1052 host_name = strndup (new_host, MAX_IPV4_HOSTLENGTH);
1053
1054 /* reset virtual port */
1055 virtual_port = server_port;
1056
1057 free(new_host);
1058 free (server_url); 1058 free (server_url);
1059 server_url = new_url; 1059 server_url = new_url;
1060 1060