Roxen.git / server / etc / modules / Roxen.pmod

version» Context lines:

Roxen.git/server/etc/modules/Roxen.pmod:11: Inside #if defined(HTTP_DEBUG)
     #ifdef HTTP_DEBUG   # define HTTP_WERR(X) report_debug("HTTP: "+X+"\n");   #else   # define HTTP_WERR(X)   #endif      // Tell Pike.count_memory this is global.   constant pike_cycle_depth = 0;    + //! Internal derived method used by the websocket module to + //! inform of a valid websocket request. + //! + //! NB: Contains a space character to ensure that the string + //! can't be generated straight from the http conection. + constant WEBSOCKET_OPEN_METHOD = "WebSocketOpen "; +    // Error handling tools      enum OnError {    THROW_INTERNAL = 0, //! Throw a generic error.    THROW_RXML, //! Throw an RXML run error.    LOG_ERROR, //! Log the error and return @expr{0@} (zero).    RETURN_ZERO, //! Return @expr{0@} (zero).   };   //! Flags to control the error handling in various functions taking an   //! argument of this type.
Roxen.git/server/etc/modules/Roxen.pmod:576:    "last-modified": "Last-Modified",    // The obsolete RFC 2068 defined this header for compatibility (19.7.1.1).    "keep-alive": "Keep-Alive",    // RFC 2965    "cookie": "Cookie",    "cookie2": "Cookie2",    "set-cookie2": "Set-Cookie2",    ])[lower_case (header)];   }    + mapping(string:mixed) upgrade_to_websocket(WebSocketAPI api, void|int masking) + //! Returns a mapping that will cause the server to upgrade the + //! connection to a WebSocket. + //! + //! @param api + //! @[WebSocketAPI] object to handle websocket requests. + //! + //! @param masking + //! Specify @[masking] to enable masking on outgoing frames. + //! + //! @note + //! This return value is only valid for http connections that + //! have the method set to @[WEBSOCKET_OPEN_METHOD]. + { +  return ([ +  "error" : Protocols.HTTP.HTTP_SWITCH_PROT, +  "upgrade_websocket" : 1, +  "masking" : masking, +  "websocket_api" : api, +  ]); + } +    mapping(string:mixed) http_low_answer( int status_code, string data )   //! Return a result mapping with the specified HTTP status code and   //! data. @[data] is sent as the content of the response and is   //! tagged as text/html.   //!   //! @note   //! The constants in @[Protocols.HTTP] can be used for status codes.   {    if(!data) data="";    HTTP_WERR("Return code "+status_code+" ("+data+")");
Roxen.git/server/etc/modules/Roxen.pmod:6466:   //! The path to look up.   //!   //! All segments in @[path] that exist in the file system when matched case   //! insensitively are converted to the same encoding and case as they have   //! when listed by @[get_dir()]. Segments that don't exist are kept as-is.   //!   //! If a segment ambiguously matches several entries in a directory   //! then it and all remaining segments are returned as-is. A warning   //! is also logged in this case, unless @[no_warn] is nonzero.   //! - //! The given path is assumed to be absolute, and it is normalized - //! with @[combine_path] before being checked. The returned paths - //! always have "/" as directory separators. If there is a trailing - //! slash then it is kept intact. + //! The given path is normalized with @[combine_path] before being checked. + //! The returned paths always have "/" as directory separators. If there is + //! a trailing slash, it is kept intact.   //!   //! @param charset   //!   //! If @[charset] is set then charset conversion is done: @[path] is   //! assumed to be a (possibly wide) unicode string, and @[charset] is   //! taken as the charset used in the file system.   //! If @[charset] isn't specified then @[path] and the filesystem are   //! assumed to be in utf-8.   //!   //! If @[charset] is given then it's assumed to be a charset accepted by
Roxen.git/server/etc/modules/Roxen.pmod:6493:   //! @returns   //! Returns a string of bytes suitable for @[Stdio.read_bytes()] et al.   //!   //! @note   //! Existing paths are cached without any time limit, but the cached   //! paths are always verified to still exist before being reused. Thus   //! the only overcaching effect that can occur is if the underlying   //! file system is case insensitive and some path segment only has   //! changed in case.   { -  ASSERT_IF_DEBUG (is_absolute_path (path)); -  +     string cache_name = "case_insens_paths";       function(string:string) encode, decode;    switch (charset && lower_case(charset)) {    case 0:    // NB: NT has a filesystem that uses UTF-16.   #if !defined(__NT__) || constant(Stdio.__HAVE_UTF8_FS__)    return this_function(utf8_to_string(path), no_warn, "utf8");   #endif    break;
Roxen.git/server/etc/modules/Roxen.pmod:6540:    if (Stdio.exist(ret)) {    //werror ("path %O -> %O (cached)\n", path, dec_path);    FSWERR("Valid.\n");    return ret;    }    FSWERR("Invalid.\n");    cache_remove (cache_name, path);    }       ret = dirname (path); -  if (ret == "" || ret == path) { // At root. +  if (ret == path) { // At root.    FSWERR(" ==> %O\n", ret);    return ret;    } -  +  if (ret != "") {    ret = recur(ret, dirname(lc_path)); -  +  }       string name = basename(path);    if (!nonexist) { -  if (array(string(8bit)) dir_list = get_dir(ret)) { +  string dir = (ret == "")? ".": ret; +  if (name == ".") { +  cache_set(cache_name, path, ret); +  FSWERR(" %O ==> %O\n", path, ret); +  return ret; +  } else if (name == "..") { +  ret = combine_path_unix(ret, name); +  cache_set(cache_name, path, ret); +  FSWERR(" %O ==> %O\n", path, ret); +  return ret; +  } else if (array(string(8bit)) dir_list = get_dir(dir)) {    string lc_name = basename (lc_path);    FSWERR(" dir: %O name: %O lc_name: %O\n", ret, name, lc_name);    string(8bit) ent_name;    int fail;       foreach (dir_list, string(8bit) enc_ent) {    string(8bit) lc_ent = enc_ent;    string wide_ent;    if (!catch (wide_ent = decode(enc_ent))) {    lc_ent = encode(Unicode.normalize(lower_case(wide_ent), "NFC"));