-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yoshihiro Tanaka wrote:
> 2008/4/5, Yoshihiro Tanaka <[EMAIL PROTECTED]>:

>> Yes, since I want to write proposal for Unit testing, I can't skip this
>>  problem. But considering GSoC program is only 2 month, I'd rather narrow
>>  down the target - to gethttp funcion.

I have a sneaking suspicion that some chunks of functionality that you'd
want to farm out in gethttp, also have code-change repurcussions
elsewhere (probably http_loop usually). So it may be difficult to
"restrict" yourself to gethttp. :)

Probably better to identify the specific chunks of logic that can be
farmed out, find out how far-reaching separating those chunks might be,
and choose some specific ones to do.

You've already identified some areas; I'll comment those when I have a
chance to look more closely at the code, for comparison with your remarks.

>>  In addition to above, we have to think about abstraction of
>>  network API and file I/O API.
>>
>>  But network API(such as fd_read_body, fd_read_hunk) exists in
>>   retr.c, and socket is opened in connect.c file, it looks that
>>  abstraction of network API would require major modification of
>>  interfaces.
> 
> Or did you mean to write wget version of socket interface?
> i.e. to write our version of socket, connect,write,read,close,bind,
> listen,accept,,,? sorry I'm confused.

Yes! That's what I meant. (Except, we don't need listen, accept; and we
only need bind to support --bind-address. We're a client, not a server. ;) )

It would be enough to write function-pointers for (say), wg_socket,
wg_connect, wg_sock_write, wg_sock_read, etc, etc, and point them at
system socket, connect, etc for "real" Wget, but at wg_test_socket,
wg_test_connect, etc for our emulated servers.

This would mean we'd need to separate uses of read() and write() on
normal files (which should continue to use the real calls, until we
replace them with the file I/O abstractions), from uses of read(),
write(), etc on sockets, which would be using our emulated versions.

Ideally, we'd replace the use of file descriptor ints with a more opaque
mechanism; but that can be done later.

If you'd prefer, you might choose to write a proposal focusing on the
server emulation, which would easily take up a summer of itself (and
then some); particularly when you realize that we would need a file
format describing the virtual server's state (what domains and URLs
exist, what sort of headers it should respond with to certain requests,
etc). If you chose to take on, you'd probably need to settle for a
subset of the final expected product.

Note that, down the road, we'll want to encapsulate the whole
sockets-layer abstraction into an object we'd pass around as an argument
(struct net_connector * ?), as we might want to use it to handle SOCKS
for some URLs, while using direct connections for others. But that
doesn't have to happen right now; once we've got the actual abstraction
done it should be pretty easy to move it to an object-based mechanism
(just use conn->connect(...) instead of wg_connect(...)). But, if you
want to go ahead and do that now, that'd be great too.

- --
Micah J. Cowan
Programmer, musician, typesetting enthusiast, gamer,
and GNU Wget Project Maintainer.
http://micah.cowan.name/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFH9+7p7M8hyUobTrERApu6AKCENiEExoyTHxDUodnr/AIcRx8BOgCcD89N
k6ANTdl+4fgb+4trcADXnO0=
=fmya
-----END PGP SIGNATURE-----

Reply via email to