Example #1
0
void ChannelsResponder::reply(std::ostream& out, cxxtools::http::Request& request, cxxtools::http::Reply& reply)
{
  QueryHandler::addHeader(reply);

  if ( request.method() != "GET") {
     reply.httpReturn(403, "To retrieve information use the GET method!");
     return;
  }
  static cxxtools::Regex imageRegex("/channels/image/*");
  static cxxtools::Regex groupsRegex("/channels/groups/*");

  if ( imageRegex.match(request.url()) ) {
     replyImage(out, request, reply);
  } else if (groupsRegex.match(request.url()) ){
     replyGroups(out, request, reply);
  } else {
     replyChannels(out, request, reply);
  }
}
Example #2
0
bool TimerValues::IsDayValid(string v)
{
  static cxxtools::Regex regex("[0-9]{4,4}-[0-9]{1,2}-[0-9]{1,2}");
  return regex.match(v);
}