devkitPro / 3ds-examples

Examples for 3DS using devkitARM, libctru, citro3d and citro2d
https://devkitpro.org/viewforum.php?f=39
453 stars 51 forks source link

overhaul httpc example #9

Closed ksanislo closed 8 years ago

ksanislo commented 8 years ago

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.

mtheall commented 8 years ago

Add spaces around the PRI* macros

ksanislo commented 8 years ago

@mtheall The original didn't have spaces around the macros, that's also a C++ vs C thing.

fincs commented 8 years ago

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.

ksanislo commented 8 years ago

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.

mtheall commented 8 years ago

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.

ksanislo commented 8 years ago

That's fine... its broken in the same way as the original.. Merge or not, you can fix it further.

mtheall commented 8 years ago

I can accept that. We can always fix the other problems ourselves.