Skip to content
Permalink
Browse files

curl: create easy handles on-demand and not ahead of time

This should again enable crazy-large download ranges of the style
[1-10000000] that otherwise easily ran out of memory starting in 7.66.0
when this new handle allocating scheme was introduced.

Reported-by: Peter Sumatra
Fixes #4393
Closes #4438
  • Loading branch information...
bagder committed Sep 23, 2019
1 parent c124e6b commit e59371a4936f8e7e2187b09a08d34d9a4c278657
Showing with 309 additions and 220 deletions.
  1. +16 −3 src/tool_cfgable.h
  2. +7 −5 src/tool_metalink.c
  3. +267 −198 src/tool_operate.c
  4. +13 −11 src/tool_operhlp.c
  5. +1 −1 src/tool_setopt.h
  6. +3 −0 src/tool_urlglob.c
  7. +2 −2 tests/data/test62
@@ -22,11 +22,9 @@
*
***************************************************************************/
#include "tool_setup.h"

#include "tool_sdecls.h"

#include "tool_metalink.h"

#include "tool_urlglob.h"
#include "tool_formparse.h"

typedef enum {
@@ -37,6 +35,20 @@ typedef enum {

struct GlobalConfig;

struct State {
struct getout *urlnode;
URLGlob *inglob;
URLGlob *urls;
char *outfiles;
char *httpgetfields;
char *uploadfile;
unsigned long infilenum; /* number of files to upload */
unsigned long up; /* upload file counter within a single upload glob */
unsigned long urlnum; /* how many iterations this single URL has with ranges
etc */
unsigned long li;
};

struct OperationConfig {
bool remote_time;
char *random_file;
@@ -262,6 +274,7 @@ struct OperationConfig {
struct GlobalConfig *global;
struct OperationConfig *prev;
struct OperationConfig *next; /* Always last in the struct */
struct State state; /* for create_transfer() */
};

struct GlobalConfig {
@@ -984,12 +984,14 @@ void delete_metalinkfile(metalinkfile *mlfile)

void clean_metalink(struct OperationConfig *config)
{
while(config->metalinkfile_list) {
metalinkfile *mlfile = config->metalinkfile_list;
config->metalinkfile_list = config->metalinkfile_list->next;
delete_metalinkfile(mlfile);
if(config) {
while(config->metalinkfile_list) {
metalinkfile *mlfile = config->metalinkfile_list;
config->metalinkfile_list = config->metalinkfile_list->next;
delete_metalinkfile(mlfile);
}
config->metalinkfile_last = 0;
}
config->metalinkfile_last = 0;
}

void metalink_cleanup(void)

0 comments on commit e59371a

Please sign in to comment.
You can’t perform that action at this time.