Team Ai
Datasetpublic

Brunobkr/llama.cpp_AlgMor24_github

ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.

sourceHugging Faceupdated 2mo agoView on Hugging Face
0likes3.1kdownloads
set-cookie.js266 linesDownload Raw Back to lib
1var defaultParseOptions = {2  decodeValues: true,3  map: false,4  silent: false,5  split: "auto", // auto = split strings but not arrays6};7 8function isForbiddenKey(key) {9  return typeof key !== "string" || key in {};10}11 12function createNullObj() {13  return Object.create(null);14}15 16function isNonEmptyString(str) {17  return typeof str === "string" && !!str.trim();18}19 20function parseString(setCookieValue, options) {21  var parts = setCookieValue.split(";").filter(isNonEmptyString);22 23  var nameValuePairStr = parts.shift();24  var parsed = parseNameValuePair(nameValuePairStr);25  var name = parsed.name;26  var value = parsed.value;27 28  options = options29    ? Object.assign({}, defaultParseOptions, options)30    : defaultParseOptions;31 32  if (isForbiddenKey(name)) {33    return null;34  }35 36  try {37    value = options.decodeValues ? decodeURIComponent(value) : value; // decode cookie value38  } catch (e) {39    console.error(40      "set-cookie-parser: failed to decode cookie value. Set options.decodeValues=false to disable decoding.",41      e42    );43  }44 45  var cookie = createNullObj();46  cookie.name = name;47  cookie.value = value;48 49  parts.forEach(function (part) {50    var sides = part.split("=");51    var key = sides.shift().trimLeft().toLowerCase();52    if (isForbiddenKey(key)) {53      return;54    }55    var value = sides.join("=");56    if (key === "expires") {57      cookie.expires = new Date(value);58    } else if (key === "max-age") {59      var n = parseInt(value, 10);60      if (!Number.isNaN(n)) cookie.maxAge = n;61    } else if (key === "secure") {62      cookie.secure = true;63    } else if (key === "httponly") {64      cookie.httpOnly = true;65    } else if (key === "samesite") {66      cookie.sameSite = value;67    } else if (key === "partitioned") {68      cookie.partitioned = true;69    } else if (key) {70      cookie[key] = value;71    }72  });73 74  return cookie;75}76 77function parseNameValuePair(nameValuePairStr) {78  // Parses name-value-pair according to rfc6265bis draft79 80  var name = "";81  var value = "";82  var nameValueArr = nameValuePairStr.split("=");83  if (nameValueArr.length > 1) {84    name = nameValueArr.shift();85    value = nameValueArr.join("="); // everything after the first =, joined by a "=" if there was more than one part86  } else {87    value = nameValuePairStr;88  }89 90  return { name: name, value: value };91}92 93function parseSetCookie(input, options) {94  options = options95    ? Object.assign({}, defaultParseOptions, options)96    : defaultParseOptions;97 98  if (!input) {99    if (!options.map) {100      return [];101    } else {102      return createNullObj();103    }104  }105 106  if (input.headers) {107    if (typeof input.headers.getSetCookie === "function") {108      // for fetch responses - they combine headers of the same type in the headers array,109      // but getSetCookie returns an uncombined array110      input = input.headers.getSetCookie();111    } else if (input.headers["set-cookie"]) {112      // fast-path for node.js (which automatically normalizes header names to lower-case)113      input = input.headers["set-cookie"];114    } else {115      // slow-path for other environments - see #25116      var sch =117        input.headers[118          Object.keys(input.headers).find(function (key) {119            return key.toLowerCase() === "set-cookie";120          })121        ];122      // warn if called on a request-like object with a cookie header rather than a set-cookie header - see #34, 36123      if (!sch && input.headers.cookie && !options.silent) {124        console.warn(125          "Warning: set-cookie-parser appears to have been called on a request object. It is designed to parse Set-Cookie headers from responses, not Cookie headers from requests. Set the option {silent: true} to suppress this warning."126        );127      }128      input = sch;129    }130  }131 132  var split = options.split;133  var isArray = Array.isArray(input);134 135  if (split === "auto") {136    split = !isArray;137  }138 139  if (!isArray) {140    input = [input];141  }142 143  input = input.filter(isNonEmptyString);144 145  if (split) {146    input = input.map(splitCookiesString).flat();147  }148 149  if (!options.map) {150    return input151      .map(function (str) {152        return parseString(str, options);153      })154      .filter(Boolean);155  } else {156    var cookies = createNullObj();157    return input.reduce(function (cookies, str) {158      var cookie = parseString(str, options);159      if (cookie && !isForbiddenKey(cookie.name)) {160        cookies[cookie.name] = cookie;161      }162      return cookies;163    }, cookies);164  }165}166 167/*168  Set-Cookie header field-values are sometimes comma joined in one string. This splits them without choking on commas169  that are within a single set-cookie field-value, such as in the Expires portion.170 171  This is uncommon, but explicitly allowed - see https://tools.ietf.org/html/rfc2616#section-4.2172  Node.js does this for every header *except* set-cookie - see https://github.com/nodejs/node/blob/d5e363b77ebaf1caf67cd7528224b651c86815c1/lib/_http_incoming.js#L128173  React Native's fetch does this for *every* header, including set-cookie.174 175  Based on: https://github.com/google/j2objc/commit/16820fdbc8f76ca0c33472810ce0cb03d20efe25176  Credits to: https://github.com/tomball for original and https://github.com/chrusart for JavaScript implementation177*/178function splitCookiesString(cookiesString) {179  if (Array.isArray(cookiesString)) {180    return cookiesString;181  }182  if (typeof cookiesString !== "string") {183    return [];184  }185 186  var cookiesStrings = [];187  var pos = 0;188  var start;189  var ch;190  var lastComma;191  var nextStart;192  var cookiesSeparatorFound;193 194  function skipWhitespace() {195    while (pos < cookiesString.length && /\s/.test(cookiesString.charAt(pos))) {196      pos += 1;197    }198    return pos < cookiesString.length;199  }200 201  function notSpecialChar() {202    ch = cookiesString.charAt(pos);203 204    return ch !== "=" && ch !== ";" && ch !== ",";205  }206 207  while (pos < cookiesString.length) {208    start = pos;209    cookiesSeparatorFound = false;210 211    while (skipWhitespace()) {212      ch = cookiesString.charAt(pos);213      if (ch === ",") {214        // ',' is a cookie separator if we have later first '=', not ';' or ','215        lastComma = pos;216        pos += 1;217 218        skipWhitespace();219        nextStart = pos;220 221        while (pos < cookiesString.length && notSpecialChar()) {222          pos += 1;223        }224 225        // currently special character226        if (pos < cookiesString.length && cookiesString.charAt(pos) === "=") {227          // we found cookies separator228          cookiesSeparatorFound = true;229          // pos is inside the next cookie, so back up and return it.230          pos = nextStart;231          cookiesStrings.push(cookiesString.substring(start, lastComma));232          start = pos;233        } else {234          // in param ',' or param separator ';',235          // we continue from that comma236          pos = lastComma + 1;237        }238      } else {239        pos += 1;240      }241    }242 243    if (!cookiesSeparatorFound || pos >= cookiesString.length) {244      cookiesStrings.push(cookiesString.substring(start, cookiesString.length));245    }246  }247 248  return cookiesStrings;249}250 251// named export for CJS252parseSetCookie.parseSetCookie = parseSetCookie;253// for backwards compatibility254parseSetCookie.parse = parseSetCookie;255parseSetCookie.parseString = parseString;256parseSetCookie.splitCookiesString = splitCookiesString;257 258// EXPORTS259// (this section is replaced by build-cjs.js)260 261// named export for ESM262export { parseSetCookie };263// for backwards compatibility264export default parseSetCookie;265export { parseSetCookie as parse, parseString, splitCookiesString };266 
Brunobkr/llama.cpp_AlgMor24_github · Team Ai