Beispiel #1
0
void* rho_dispatch(struct conn *c, const char* path) {
  RouteRef route;

  if ( _shttpd_match_extension(c->uri,"css,js,html,htm,png,bmp,jpg") )
    return NULL;

  if ((route = _alloc_route(c->uri)) != NULL) {
    if (_parse_route(route)) {
      struct stat	st;
      //is this an actual file or folder
      if (_shttpd_stat(path, &st) != 0)
        return route;      
      //is this a folder
      if (S_ISDIR(st.st_mode)) {
        //check if there is controller.rb to run
        char	filename[FILENAME_MAX];
        int len = strlen(path);
        char* slash = path[len-1] == '\\' || path[len-1] == '/' ? "" : "/";
        _shttpd_snprintf(filename,sizeof(filename),"%s%s%s",path,slash,"controller.iseq");

        if ((_shttpd_stat(filename, &st) == 0)&&(!S_ISDIR(st.st_mode))) {
          printf("Run controller on this url: %s\n", c->uri);
          return route;
        }
      }
    }
    _free_route(route);
  }

  return NULL;
}
Beispiel #2
0
void* rho_dispatch(struct conn *c, const char* path) {
  RouteRef route;
  
  if ( _shttpd_match_extension(c->uri,"css,js,html,htm,png,bmp,jpg") )
    return NULL;

#ifdef __SYMBIAN32__
  if ( strstr(_shttpd_known_http_methods[c->method].ptr, "GET" ) )
	  webview_set_current_location(c->uri);
#endif
  
  if ((route = _alloc_route(c->uri)) != NULL) {
    if (_parse_route(route)) {
      struct stat	st;
      //is this an actual file or folder
      if (_shttpd_stat(path, &st) != 0)
        return route;      
      //is this a folder
      if (S_ISDIR(st.st_mode)) {
        //check if there is controller.rb to run
        char	filename[FILENAME_MAX];
        int len = strlen(path);
        char* slash = path[len-1] == '\\' || path[len-1] == '/' ? "" : "/";
        _shttpd_snprintf(filename,sizeof(filename),"%s%s%s",path,slash,"controller.iseq");

        if ((_shttpd_stat(filename, &st) == 0)&&(!S_ISDIR(st.st_mode))) {
          RAWLOG_INFO1("Run controller on this url: %s", c->uri);
          return route;
        }
      }
    }
    _free_route(route);
  }

  return NULL;
}