cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: making commands removable / replaceable?

From: Armel Asselin <asselin.armel_at_wanadoo.fr>
Date: Tue, 22 Aug 2006 20:39:37 +0200

> we discussed some days ago about making FTP commands (why not others
> protocols?) removable (for some of them > at least) and replaceable, here
> is the state of the discussion:
> - we'd like to have an option (let's say CURLOPT_COMMANDSCHANGES) which
> would be an slist of lines like > > that:
> SIZE: (to remove the command, the \0 should come just after the
> colon)
> SIZE:SUPERSZ (to replace the SIZE commands with SUPERSZ commands)
>
> Here are some propositions:
>
> - as most 'write' high-level commands are in fact based on printf, the
> command could be replaced with %s and a first > > parameter with the
> command text.
> - for commands which cannot yet be disabled, curl_get_command_text(conn,
> "SIZE") for example. curl_get_command_text would return its parameter if
> it's not found in the changed commands.
> - for commands which can be disabled, a curl_is_command_enabled (conn,
> command, newtext) could be implemented. By default all commands are
> enabled (unless specified by some other CURLOPT_ stuff), if enabled the
> newtext would be set to actual text to send (by default original command
> text).

OK, so I started to add that:
- in urldata.h, added a struct slist *commands_changes member to UserDefined
structure
- added that in ftp.c currently:
char *curl_get_command_text(struct UserDefined *data, char *original_cmd);
bool curl_is_command_enabled(struct UserDefined *data, char *original_cmd,
char **new_cmd);
? where should i put these two prototypes (urldata.h?), and the definition,
to make them available to all the modules?

currently replacement of SIZE command is supported, and disabling SIZE also.

Armel
Received on 2006-08-22