cURL / Mailing Lists / curl-library / Single Mail

curl-library

RE: URL parsing

From: Steve Holme <steve_holme_at_hotmail.com>
Date: Sun, 14 Apr 2013 16:43:25 +0100

Hi Daniel,

On Sun, 14 Apr 2013, Steve Holme wrote:

> > At times authors of applications want to provide user + password
> > separate from the URL for various reasons. I figure the same will go
> > for "options" associated with it as well...
>
> Sure - I will work on adding this as well.

I've got a little stuck, as I'm not too sure which the best approach here
is, so wondered if you could provide a little guidance please?

The area of code I have already added to uses a fixed length buffer, which
has been defined further up the call stack when parse_url_userpass() is
called. This function as we know then uses sscanf().

The other area of code that I am now adding to, setstropt_userpwd(),
performs a strchr() for ':' and then dynamically allocates the user and
password buffers.

I can quickly fix up setstropt_userpwd() to look for ';' as well but I'm big
into code reuse and would rather both functions call a parse_login_details()
type function instead. I appreciate I'm making more work for myself here,
but it seems a little daft, IMHO, for the URL parsing, proxy URL parsing and
--user argument parsing all to do their own parsing.

I think the best approach is to get rid of the fixed width buffers in
create_conn() but just wondered if you agree?

Kind Regards

Steve
-------------------------------------------------------------------
List admin: http://cool.haxx.se/list/listinfo/curl-library
Etiquette: http://curl.haxx.se/mail/etiquette.html
Received on 2013-04-14