2008/4/5, Micah Cowan <[EMAIL PROTECTED]>:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Daniel Stenberg wrote:
> > This system allows us to write unit-tests if we'd like to, but mostly so
> > far we've focused to test it system-wide. It is hard enough for us!
>
>
> Yeah, I thought I'd seen something like that; I was thinking we might
> even be able to appropriate some of that, if that looked doable. Except
> that I preferred faking the server completely, so I could deal better
> with cross-site issues, which AFAICT are significantly more important to
> Wget than they are to Curl.
>
It seems that abstraction of network API needs more discussion,
so I would focus on the server emulation....
By the way, How about using LD_PRELOAD ?
I tested a little and it seems to be working. If we use this, we can test
by overriding socket interface, and still we don't change wget real source
code.
------main.c --------------------------
#include <stdio.h>
int main(void)
{
puts("Helow Wgets\n");
return 0;
}
----------------------------------------
------testputs.c ------------------------
#include <stdio.h>
int puts(const char *str)
{
while(*str)
putchar(*str++);
printf("This is a test module");
putchar('\n');
}
-----------------------------------------
--Compile like below:
[EMAIL PROTECTED] Test]$ gcc main.c -o main
[EMAIL PROTECTED] Test]$ gcc -fPIC -shared -o testputs.so testputs.c
--Execute like below:
[EMAIL PROTECTED] Test]$ ./main
Helow Wgets
[EMAIL PROTECTED] Test]$ LD_PRELOAD=./testputs.so ./main
Helow Wgets
This is a test module
----------
I found this way on the net, and sample was using wget !! they are overriding
socket, close, and connect.
http://www.t-dori.net/forensics/hook_tcp.cpp
--
Yoshihiro TANAKA