Loading src/tool_operate.c +37 −11 Original line number Original line Diff line number Diff line Loading @@ -102,6 +102,24 @@ "If you'd like to turn off curl's verification of the certificate, use\n" \ "If you'd like to turn off curl's verification of the certificate, use\n" \ " the -k (or --insecure) option.\n" " the -k (or --insecure) option.\n" static int is_fatal_error(int code) { switch(code) { /* TODO: Should CURLE_SSL_CACERT be included as critical error ? */ case CURLE_FAILED_INIT: case CURLE_OUT_OF_MEMORY: case CURLE_UNKNOWN_OPTION: case CURLE_FUNCTION_NOT_FOUND: case CURLE_BAD_FUNCTION_ARGUMENT: /* critical error */ return 1; default: break; } /* no error or not critical */ return 0; } int operate(struct Configurable *config, int argc, argv_item_t argv[]) int operate(struct Configurable *config, int argc, argv_item_t argv[]) { { char errorbuffer[CURL_ERROR_SIZE]; char errorbuffer[CURL_ERROR_SIZE]; Loading Loading @@ -1463,6 +1481,15 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) infd = STDIN_FILENO; infd = STDIN_FILENO; } } if(urlnum > 1) { /* when url globbing, exit loop upon critical error */ if(is_fatal_error(res)) break; } else if(res) /* when not url globbing, exit loop upon any error */ break; } /* loop to the next URL */ } /* loop to the next URL */ /* Free loop-local allocated memory */ /* Free loop-local allocated memory */ Loading @@ -1475,6 +1502,15 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) urls = NULL; urls = NULL; } } if(infilenum > 1) { /* when file globbing, exit loop upon critical error */ if(is_fatal_error(res)) break; } else if(res) /* when not file globbing, exit loop upon any error */ break; } /* loop to the next globbed upload file */ } /* loop to the next globbed upload file */ /* Free loop-local allocated memory */ /* Free loop-local allocated memory */ Loading @@ -1494,21 +1530,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) Curl_safefree(urlnode->infile); Curl_safefree(urlnode->infile); urlnode->flags = 0; urlnode->flags = 0; /* TODO: Should CURLE_SSL_CACERT be included as critical error ? */ /* /* ** Bail out upon critical errors ** Bail out upon critical errors */ */ switch(res) { if(is_fatal_error(res)) case CURLE_FAILED_INIT: case CURLE_OUT_OF_MEMORY: case CURLE_FUNCTION_NOT_FOUND: case CURLE_BAD_FUNCTION_ARGUMENT: goto quit_curl; goto quit_curl; default: /* Merrily loop to next URL */ break; } } /* for-loop through all URLs */ } /* for-loop through all URLs */ Loading Loading
src/tool_operate.c +37 −11 Original line number Original line Diff line number Diff line Loading @@ -102,6 +102,24 @@ "If you'd like to turn off curl's verification of the certificate, use\n" \ "If you'd like to turn off curl's verification of the certificate, use\n" \ " the -k (or --insecure) option.\n" " the -k (or --insecure) option.\n" static int is_fatal_error(int code) { switch(code) { /* TODO: Should CURLE_SSL_CACERT be included as critical error ? */ case CURLE_FAILED_INIT: case CURLE_OUT_OF_MEMORY: case CURLE_UNKNOWN_OPTION: case CURLE_FUNCTION_NOT_FOUND: case CURLE_BAD_FUNCTION_ARGUMENT: /* critical error */ return 1; default: break; } /* no error or not critical */ return 0; } int operate(struct Configurable *config, int argc, argv_item_t argv[]) int operate(struct Configurable *config, int argc, argv_item_t argv[]) { { char errorbuffer[CURL_ERROR_SIZE]; char errorbuffer[CURL_ERROR_SIZE]; Loading Loading @@ -1463,6 +1481,15 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) infd = STDIN_FILENO; infd = STDIN_FILENO; } } if(urlnum > 1) { /* when url globbing, exit loop upon critical error */ if(is_fatal_error(res)) break; } else if(res) /* when not url globbing, exit loop upon any error */ break; } /* loop to the next URL */ } /* loop to the next URL */ /* Free loop-local allocated memory */ /* Free loop-local allocated memory */ Loading @@ -1475,6 +1502,15 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) urls = NULL; urls = NULL; } } if(infilenum > 1) { /* when file globbing, exit loop upon critical error */ if(is_fatal_error(res)) break; } else if(res) /* when not file globbing, exit loop upon any error */ break; } /* loop to the next globbed upload file */ } /* loop to the next globbed upload file */ /* Free loop-local allocated memory */ /* Free loop-local allocated memory */ Loading @@ -1494,21 +1530,11 @@ int operate(struct Configurable *config, int argc, argv_item_t argv[]) Curl_safefree(urlnode->infile); Curl_safefree(urlnode->infile); urlnode->flags = 0; urlnode->flags = 0; /* TODO: Should CURLE_SSL_CACERT be included as critical error ? */ /* /* ** Bail out upon critical errors ** Bail out upon critical errors */ */ switch(res) { if(is_fatal_error(res)) case CURLE_FAILED_INIT: case CURLE_OUT_OF_MEMORY: case CURLE_FUNCTION_NOT_FOUND: case CURLE_BAD_FUNCTION_ARGUMENT: goto quit_curl; goto quit_curl; default: /* Merrily loop to next URL */ break; } } /* for-loop through all URLs */ } /* for-loop through all URLs */ Loading