Closed ksanislo closed 8 years ago
Add spaces around the PRI* macros
@mtheall The original didn't have spaces around the macros, that's also a C++ vs C thing.
I think good C code should be compilable as-is as C++. It is pointless to introduce a gratuitous incompatibility just because some people deem it a "bad" practice. From the type system point of view, implicitly casting void* to anything more restrictive makes no sense whatsoever. C++ fixed this aspect making it formally illegal to do so.
Jesus christ people, I'm trying to fix a downright /awful/ example of how to use HTTP because I keep running across everyone using it incorrectly... I don't actually /care/ that much about this, it's still an awful example, it just doesn't butcher http anymore.
Even though this is a C-source file, I agree with fincs: it should compile with no warnings in both C and C++. The main reason being that this is example code, which inevitably means someone is going to copy/paste it into either a C or C++ project.
That's fine... its broken in the same way as the original.. Merge or not, you can fix it further.
I can accept that. We can always fix the other problems ourselves.
The existing http:c example has extensive design flaws in it, this rewrite provides an overall better example that works much better.
This can handle chunked encoding, CGI content, url redirection, and dynamic/streaming download, and gives examples providing a User-Agent header, and using Keep-Alive to avoid teardown and rebuild of every connection.