Sun Jul 29 22:18:52 CEST 2007
-----BEGIN PGP SIGNED MESSAGE-----
> Nice. Some comments and questions though:
> - From the "strict C" department: since strstr(3) returns a pointer,
> comparing to NULL is more appropriate (though 0 is technically not
> - strstr(3) is a basicylly substring search. I don't know if a mere
> substring search is not too broad. Personally I would define exact
> URLs (like the given ones) and check it more strict to be on the
> position in the request.
Okay, I'm a C beginner and blindly adapted the old functions ;)
> - From the department of "beautiful implementation": I wonder if it
> wouldn't be nicer to put the functions + URL parts in a table, look
> for the (relevant part of the) given URL and call the associated
> If none is found, call all functions.
> If the sequence of the table resembles the current sequence, the
> output won't change AFAICS.
Yes, you're right. Now I use a lookup table where possible request urls
are mapped to function pointers. The reworked patch is attached.
I left the combined links + neighbours output ("/neighbours", with "u")
in place to keep the whole thing somewhat backwards compatible. Instead
I added the additional url "/neighbors" (named after the actual table)
to get the neighbor table alone.
Bad HTTP requests, e.g. request urls longer than 16 bytes, will trigger
a "400 Bad HTTP Request" response and unknown ones will generate a
friendly "not supported" message.
The patch was developed against olsrd 0.4.10 but seems to apply fine to
version 0.5.1 . I tested the changed plugin with both olsrd 0.4.10 for
mipsel running on OpenWRT Whiterussian and with olsrd 0.5.1 for mipsel
running on OpenWRT Kamikaze.
Greetings from Leipzig,
xM a.k.a. jow
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
-----END PGP SIGNATURE-----
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 7603 bytes
Desc: not available
More information about the Olsr-dev