}
}
-void url_fopen(string url, float mode, url_ready_func rdy, entity pass)
+void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass)
{
entity e;
float i;
// create a writing end that does nothing yet
e = spawn();
- e.classname = "url_fopen_file";
+ e.classname = "url_single_fopen_file";
e.url_url = strzone(url);
e.url_fh = URL_FH_CURL;
e.url_wbuf = buf_create();
if(e.url_wbuf < 0)
{
- print("url_fopen: out of memory in buf_create\n");
+ print("url_single_fopen: out of memory in buf_create\n");
rdy(e, pass, URL_READY_ERROR);
strunzone(e.url_url);
remove(e);
break;
if(i >= autocvar__urllib_nextslot)
{
- print("url_fopen: too many concurrent requests\n");
+ print("url_single_fopen: too many concurrent requests\n");
rdy(world, pass, URL_READY_ERROR);
return;
}
// GET the data
if(!crypto_uri_postbuf(url, i + MIN_URL_ID, string_null, string_null, -1, 0))
{
- print("url_fopen: failure in crypto_uri_postbuf\n");
+ print("url_single_fopen: failure in crypto_uri_postbuf\n");
rdy(world, pass, URL_READY_ERROR);
return;
}
// all). Wait for data to come from the
// server, then call the callback
e = spawn();
- e.classname = "url_fopen_file";
+ e.classname = "url_single_fopen_file";
e.url_url = strzone(url);
e.url_fh = URL_FH_CURL;
e.url_rbuf = -1;
case FILE_WRITE:
case FILE_APPEND:
e = spawn();
- e.classname = "url_fopen_stdout";
+ e.classname = "url_single_fopen_stdout";
e.url_fh = URL_FH_STDOUT;
rdy(e, pass, URL_READY_CANWRITE);
break;
case FILE_READ:
- print("url_fopen: cannot open '-' for reading\n");
+ print("url_single_fopen: cannot open '-' for reading\n");
rdy(world, pass, URL_READY_ERROR);
break;
}
else
{
e = spawn();
- e.classname = "url_fopen_file";
+ e.classname = "url_single_fopen_file";
e.url_fh = fh;
if(mode == FILE_READ)
rdy(e, pass, URL_READY_CANREAD);
remove(me);
return;
}
- url_fopen(argv(me.cnt), me.lip, url_multi_ready, me);
+ url_single_fopen(argv(me.cnt), me.lip, url_multi_ready, me);
return;
}
me.url_ready(fh, me.url_ready_pass, status);
me.lip = mode;
me.url_ready = rdy;
me.url_ready_pass = pass;
- url_fopen(argv(0), mode, url_multi_ready, me);
+ url_single_fopen(argv(0), mode, url_multi_ready, me);
}
// errors: -1, or negative HTTP status code
typedef void(entity handle, entity pass, float status) url_ready_func;
-void url_fopen(string url, float mode, url_ready_func rdy, entity pass);
+void url_single_fopen(string url, float mode, url_ready_func rdy, entity pass);
void url_fclose(entity e, url_ready_func rdy, entity pass);
string url_fgets(entity e);
void url_fputs(entity e, string s);