Use boost date_time to parse and create HTTP-dates
- by John Price
I'm writing a kind of HTTP proxy, so I need to be able to do 3 things:
Parse an HTTP-date given any of the 3 formats specified in RFC 2616, sec 3.3,
Convert a file date-time to an HTTP-date string, and
Output the date to a string.
For reference, theses are examples of the date-times I need to parse. I will output only the first format:
Sun, 06 Nov 1994 08:49:37 GMT ; RFC 822, updated by RFC 1123
Sunday, 06-Nov-94 08:49:37 GMT ; RFC 850, obsoleted by RFC 1036
Sun Nov 6 08:49:37 1994 ; ANSI C's asctime() format
I'm pretty sure Boost date_time can do all of this, but I'm having some trouble with number 1. Does anyone already have code to do this? Perhaps I'm not using google proficiently, but I can't find an example of how to do this with boost anywhere.
Thanks for any help!