On Mon, Jun 27, 2005 at 06:30:43PM -0000, [EMAIL PROTECTED] wrote:
> This is an automated notification of a change to the ELinks CVS tree.
>
> Author: witekfl
> Module: elinks
> Tag: <TRUNK>
> Date: Mon Jun 27 18:30:43 2005 GMT
>
> ---- Log message:
>
> Experimental support for FSP protocol as CGI script.
> Need to rewrite some parts of ELinks (treat smart prefixes as valid protocol
> names and/or treat file:///blabla?query as valid base href).
This is a fun, modular way to introduce support for a new protocol.
[...]
> +void
> +error(const char *str)
> +{
> + printf("Content-Type: text/plain\r\nConnection: close\r\n\r\n");
> + puts(str);
> + printf("%s\n", query);
> + exit(1);
> +}
Is there any reason not to use two puts statements or a single printf
instead of the puts and the second printf?
When I first saw this, I thought that it was strange that you used \r\n
for the first three lines and \n for the next two, but I guess that this
is fine because HTTP only cares about the line-endings for the header.
Maybe a comment is in order, or maybe this is obvious enough.
> +
> +void
> +process_directory(FSP_SESSION *ses)
> +{
> + char buf[1024];
> + FSP_DIR *dir;
> +
> + snprintf(buf, 1024, "fsp:%s:%d%s/", data.host, data.port, data.path);
Better to use sizeof(*buf), isn't it?
[...]
> +void
> +process_query(void)
> +{
> + char *at = strchr(query, '@');
> + char *colon;
> + char *slash;
> +
> + if (at) {
> + *at = '\0';
> + data.password = strdup(query);
> + query = at + 1;
> + }
> + colon = strchr(query, ':');
> + if (colon) {
> + *colon = '\0';
> + data.host = strdup(query);
> + data.port = atoi(colon + 1);
> + slash = strchr(colon + 1, '/');
> + if (slash) {
> + data.path = strdup(slash);
> + } else {
> + data.path = "/";
> + }
> + } else {
> + data.port = 21;
> + slash = strchr(query, '/');
> + if (slash) {
> + *slash = '\0';
> + data.host = strdup(query);
> + *slash = '/';
> + data.path = strdup(slash);
> + } else {
> + data.host = strdup(query);
> + data.path = "/";
> + }
> + }
> + process_data();
> +}
Is the format of an FSP URI 'fsp://[EMAIL PROTECTED]:port/path'? A comment
would be nice. Where did you get the format? I am particularly curious
about the password field.
[...]
--
Miciah Masters <[EMAIL PROTECTED]> / <[EMAIL PROTECTED]>
_______________________________________________
elinks-dev mailing list
[email protected]
http://linuxfromscratch.org/mailman/listinfo/elinks-dev