Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 22 Jul 2001
Offline Last Active Jun 14 2016 08:20 AM

Posts I've Made

In Topic: File upload server

16 March 2015 - 06:26 AM

In the distributed storage software we use, clients authenticate with client certificates over TLS HTTP with the head nodes, which may either proxy the data to the storage pools or redirect the client to issue its PUT to the storage pools over unauthenticated HTTP.


The mechanism of redirect-on-PUT requires that the client _must_ issue a "expect 100 continue" on its initial request. This is so that the server will have the ability to decide on if to accept the data directly (by responding with a 100 continue), or redirect/reject/whatever with 30x/40x.


Our storage uses dynamically opened ports on the storage nodes and have a GUID as query parameter to figure out where to put stuff, but it's in no way secure. In your case, you'd either have to delegate credentials to the clients as part of the URLs, or make your S3 world-writable and pray.

In Topic: Question About Port assignments

16 March 2015 - 06:19 AM

To quote MSDN's bind documentation for a socket "For TCP/IP, if the port is specified as zero, the service provider assigns a unique port to the application from the dynamic client port range."


Note that this is "new" behaviour on Vista and up, so if you're amusing enough to target XP, XP64 and/or Server 2003, you're going to end up with an interesting selection of reasonably low ports.

In Topic: will make help me?

03 June 2014 - 12:23 PM

In some projects, includes are required to be relative to the top of the hierarchy. This allows you to have a single include directory, typically with an absolute path, and simply include headers by their full path relative that location.




In which foo.cc would include files in a manner like:


#include <boost/thread/thread.hpp>

#include <my/awesome/graphics/buffer.hpp>

#include <my/awesome/network/buffer.hpp>


By retaining the path information in the include directive you gain location independence and the ability to distinguish between several headers with the same filename.

In Topic: [C++] Is there an easy way to mimic printf()'s behavior?

03 April 2014 - 04:27 AM

Perhaps this would work:

	char str[255];


The core problem with using a C-style printf is that you have to either guess at the length of the resulting string or use one of the "safe" sized variants of printf and attempt with larger and larger buffers until the resulting string fits.


This is more pretty_fatal_stack_smash than pretty_fatal_message_format.

In Topic: Inline assembly

15 March 2013 - 09:10 AM

If you want to do runtime x86 and x86_64 code generation properly (and yes, there's use cases for it), I would recommend using Xbyak. Nice little C++ DSL to generate machine code at runtime, complete with labels, jumping to them and all sorts of nice stuff.