Uname:Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64

Base Dir : /var/www/html

User : gavin


403WebShell
403Webshell
Server IP : 68.183.124.220  /  Your IP : 216.73.217.137
Web Server : Apache/2.4.18 (Ubuntu)
System : Linux Sandbox-A 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64
User : gavin ( 1000)
PHP Version : 7.0.33-0ubuntu0.16.04.16
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /home/gavin/workspace/happymandarin/node_modules/busboy/test/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/gavin/workspace/happymandarin/node_modules/busboy/test/test-utils-parse-params.js
var parseParams = require('../lib/utils').parseParams;

var path = require('path'),
    assert = require('assert'),
    inspect = require('util').inspect;

var group = path.basename(__filename, '.js') + '/';

[
  { source: 'video/ogg',
    expected: ['video/ogg'],
    what: 'No parameters'
  },
  { source: 'video/ogg;',
    expected: ['video/ogg'],
    what: 'No parameters (with separator)'
  },
  { source: 'video/ogg; ',
    expected: ['video/ogg'],
    what: 'No parameters (with separator followed by whitespace)'
  },
  { source: ';video/ogg',
    expected: ['', 'video/ogg'],
    what: 'Empty parameter'
  },
  { source: 'video/*',
    expected: ['video/*'],
    what: 'Subtype with asterisk'
  },
  { source: 'text/plain; encoding=utf8',
    expected: ['text/plain', ['encoding', 'utf8']],
    what: 'Unquoted'
  },
  { source: 'text/plain; encoding=',
    expected: ['text/plain', ['encoding', '']],
    what: 'Unquoted empty string'
  },
  { source: 'text/plain; encoding="utf8"',
    expected: ['text/plain', ['encoding', 'utf8']],
    what: 'Quoted'
  },
  { source: 'text/plain; greeting="hello \\"world\\""',
    expected: ['text/plain', ['greeting', 'hello "world"']],
    what: 'Quotes within quoted'
  },
  { source: 'text/plain; encoding=""',
    expected: ['text/plain', ['encoding', '']],
    what: 'Quoted empty string'
  },
  { source: 'text/plain; encoding="utf8";\t   foo=bar;test',
    expected: ['text/plain', ['encoding', 'utf8'], ['foo', 'bar'], 'test'],
    what: 'Multiple params with various spacing'
  },
  { source: "text/plain; filename*=iso-8859-1'en'%A3%20rates",
    expected: ['text/plain', ['filename', '£ rates']],
    what: 'Extended parameter (RFC 5987) with language'
  },
  { source: "text/plain; filename*=utf-8''%c2%a3%20and%20%e2%82%ac%20rates",
    expected: ['text/plain', ['filename', '£ and € rates']],
    what: 'Extended parameter (RFC 5987) without language'
  },
  { source: "text/plain; filename*=utf-8''%E6%B5%8B%E8%AF%95%E6%96%87%E6%A1%A3",
    expected: ['text/plain', ['filename', '测试文档']],
    what: 'Extended parameter (RFC 5987) without language #2'
  },
  { source: "text/plain; filename*=iso-8859-1'en'%A3%20rates; altfilename*=utf-8''%c2%a3%20and%20%e2%82%ac%20rates",
    expected: ['text/plain', ['filename', '£ rates'], ['altfilename', '£ and € rates']],
    what: 'Multiple extended parameters (RFC 5987) with mixed charsets'
  },
  { source: "text/plain; filename*=iso-8859-1'en'%A3%20rates; altfilename=\"foobarbaz\"",
    expected: ['text/plain', ['filename', '£ rates'], ['altfilename', 'foobarbaz']],
    what: 'Mixed regular and extended parameters (RFC 5987)'
  },
  { source: "text/plain; filename=\"foobarbaz\"; altfilename*=iso-8859-1'en'%A3%20rates",
    expected: ['text/plain', ['filename', 'foobarbaz'], ['altfilename', '£ rates']],
    what: 'Mixed regular and extended parameters (RFC 5987) #2'
  },
  { source: 'text/plain; filename="C:\\folder\\test.png"',
    expected: ['text/plain', ['filename', 'C:\\folder\\test.png']],
    what: 'Unescaped backslashes should be considered backslashes'
  },
  { source: 'text/plain; filename="John \\"Magic\\" Smith.png"',
    expected: ['text/plain', ['filename', 'John "Magic" Smith.png']],
    what: 'Escaped double-quotes should be considered double-quotes'
  },
  { source: 'multipart/form-data; charset=utf-8; boundary=0xKhTmLbOuNdArY',
    expected: ['multipart/form-data', ['charset', 'utf-8'], ['boundary', '0xKhTmLbOuNdArY']],
    what: 'Multiple non-quoted parameters'
  },
].forEach(function(v) {
  var result = parseParams(v.source),
      msg = '[' + group + v.what + ']: parsed parameters mismatch.\n'
            + 'Saw: ' + inspect(result) + '\n'
            + 'Expected: ' + inspect(v.expected);
  assert.deepEqual(result, v.expected, msg);
});

Youez - 2016 - github.com/yon3zu
LinuXploit