Skip to content

Commit

Permalink
Merge pull request #511 from matsumotory/mruby-3.2
Browse files Browse the repository at this point in the history
  • Loading branch information
matsumotory authored Sep 26, 2023
2 parents 872d9df + 863a063 commit 3f41c72
Show file tree
Hide file tree
Showing 333 changed files with 24,248 additions and 13,352 deletions.
46 changes: 23 additions & 23 deletions build_config.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
MRuby::Build.new('host') do |conf|

toolchain :gcc

conf.defines << 'MRB_STR_LENGTH_MAX=10485760'
conf.gembox 'full-core'

conf.cc do |cc|
Expand All @@ -16,19 +16,19 @@
#
# Recommended for ngx_mruby
#
conf.gem :github => 'iij/mruby-env'
conf.gem :github => 'iij/mruby-dir'
conf.gem :github => 'iij/mruby-digest'
conf.gem :github => 'iij/mruby-process'
conf.gem :github => 'mattn/mruby-json'
conf.gem :github => 'mattn/mruby-onig-regexp'
conf.gem :github => 'matsumotory/mruby-redis'
conf.gem :github => 'matsumotory/mruby-vedis'
conf.gem :github => 'matsumotory/mruby-userdata'
conf.gem :github => 'matsumotory/mruby-uname'
conf.gem :github => 'matsumotory/mruby-mutex'
conf.gem :github => 'matsumotory/mruby-localmemcache'
conf.gem :mgem => 'mruby-secure-random'
conf.gem github: 'iij/mruby-env'
conf.gem github: 'iij/mruby-dir'
conf.gem github: 'iij/mruby-digest'
conf.gem github: 'iij/mruby-process'
conf.gem github: 'mattn/mruby-json'
conf.gem github: 'mattn/mruby-onig-regexp'
conf.gem github: 'matsumotory/mruby-redis'
conf.gem github: 'matsumotory/mruby-vedis'
conf.gem github: 'matsumotory/mruby-userdata'
conf.gem github: 'matsumotory/mruby-uname'
conf.gem github: 'matsumotory/mruby-mutex'
conf.gem github: 'matsumotory/mruby-localmemcache'
conf.gem mgem: 'mruby-secure-random'

# ngx_mruby extended class
conf.gem './mrbgems/ngx_mruby_mrblib'
Expand All @@ -45,20 +45,20 @@
# conf.gem :github => 'matsumotory/mruby-discount'

# use mysql on ngx_mruby
#conf.gem :github => 'mattn/mruby-mysql'
# conf.gem :github => 'mattn/mruby-mysql'

# have GeoIPCity.dat
# conf.gem :github => 'matsumotory/mruby-geoip'

# Linux only for ngx_mruby
# conf.gem :github => 'matsumotory/mruby-capability'
# conf.gem :github => 'matsumotory/mruby-cgroup'

end

MRuby::Build.new('test') do |conf|
# load specific toolchain settings

conf.defines << 'MRB_STR_LENGTH_MAX=10485760'
# Gets set by the VS command prompts.
if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
toolchain :visualcpp
Expand All @@ -68,13 +68,13 @@

enable_debug

conf.gem :github => 'matsumotory/mruby-simplehttp'
conf.gem :github => 'matsumotory/mruby-httprequest'
conf.gem :github => 'matsumotory/mruby-uname'
conf.gem :github => 'matsumotory/mruby-simpletest'
conf.gem :github => 'mattn/mruby-http'
conf.gem :github => 'mattn/mruby-json'
conf.gem :github => 'iij/mruby-env'
conf.gem github: 'matsumotory/mruby-simplehttp'
conf.gem github: 'matsumotory/mruby-httprequest'
conf.gem github: 'matsumotory/mruby-uname'
conf.gem github: 'matsumotory/mruby-simpletest'
conf.gem github: 'mattn/mruby-http'
conf.gem github: 'mattn/mruby-json'
conf.gem github: 'iij/mruby-env'

# include the default GEMs
conf.gembox 'full-core'
Expand Down
48 changes: 24 additions & 24 deletions mrbgems/ngx_mruby_mrblib/mrblib/mrb_nginx.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
class Nginx
class Request
def scheme
self.var.scheme
var.scheme
end

def document_root
Expand All @@ -14,32 +14,33 @@ def read_body
end

def body
self.get_body
get_body
end

def uri_args
args_to_hash(self.args)
args_to_hash(args)
end

def uri_args=(params)
raise ArgumentError unless params.is_a?(Hash)
self.args = params.map{|k,v| "#{k}=#{v}"}.join("&")

self.args = params.map { |k, v| "#{k}=#{v}" }.join('&')
end

def post_args
args_to_hash(self.body)
args_to_hash(body)
end

private

def args_to_hash(args)
Hash[*args.split("&").map{|arg| arg.split("=", 2)}.flatten]
Hash[*args.split('&').map { |arg| arg.split('=', 2) }.flatten]
end
end

class Headers_in
def user_agent
self["User-Agent"]
self['User-Agent']
end
end

Expand All @@ -50,32 +51,32 @@ def self.var
class Utils
class << self
def encode_parameters(params, delimiter = '&', quote = nil)
if params.is_a?(Hash)
params = params.map do |key, value|
sprintf("%s=%s%s%s", escape(key), quote, escape(value), quote)
end
else
params = params.map { |value| escape(value) }
end
params = if params.is_a?(Hash)
params.map do |key, value|
format('%s=%s%s%s', escape(key), quote, escape(value), quote)
end
else
params.map { |value| escape(value) }
end
delimiter ? params.join(delimiter) : params
end

def escape(str)
reserved_str = [
"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "n", "m", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z",
"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z",
"0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
"-", ".", "_", "~"
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'n', 'm', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
'-', '.', '_', '~'
]
tmp = ''
str = str.to_s
str.size.times do |idx|
chr = str[idx]
if reserved_str.include?(chr)
tmp += chr
else
tmp += "%" + chr.unpack("H*").first.upcase
end
tmp += if reserved_str.include?(chr)
chr
else
'%' + chr.unpack1('H*').upcase
end
end
tmp
end
Expand Down Expand Up @@ -122,7 +123,6 @@ class Response
end
end


module Kernel
def get_server_class
Nginx
Expand Down
14 changes: 14 additions & 0 deletions mruby/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.DS_Store
.idea
.vscode
*.bak
*.iml
*.ipr
*.swp
*.tmp

/.yardoc
/bin
/build
/doc/api
/doc/capi
27 changes: 9 additions & 18 deletions mruby/.editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -8,36 +8,27 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 8
indent_style = tab
indent_size = 2
indent_style = space
insert_final_newline = true
tab_width = 8
trim_trailing_whitespace = true

[{Makefile,Makefile.*,makefile,*.mk}]
trim_trailing_whitespace = true
indent_style = tab
#max_line_length = 80

[*.{c,cc,C,cxx,cpp,h,hh,H,hxx,hpp,inc,y}]
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
#[*.{c,cc,C,cxx,cpp,h,hh,H,hxx,hpp,inc,y}]
#max_line_length = 120

[{*.rb,Rakefile,rakefile,*.rake,*.gemspec,*.gembox}]
indent_size = 2
indent_style = space
trim_trailing_whitespace = true
#[{*.rb,Rakefile,rakefile,*.rake,*.gemspec,*.gembox}]
#max_line_length = 120

# limitation to US-ASCII
[*.bat]
charset = latin1
end_of_line = crlf
#max_line_length = 80

[*.{yaml,yml}]
indent_size = 2
indent_style = space
#[*.{yaml,yml}]

[*.md]
indent_size = 2
indent_style = space
#[*.md]
2 changes: 2 additions & 0 deletions mruby/.git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
6fc5dc986a5ffc1a74c63ad0617ea1dcc10d3cdd
# reformatted doc/opcode.md
61e8a540869c57ebddac53cf9d243db407d57fff
# reindent parse.y
650ffb9d8410e1ae2206890ef6e2a8643c600454
4 changes: 4 additions & 0 deletions mruby/.gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
* text=auto eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.png binary
7 changes: 5 additions & 2 deletions mruby/.github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Basic set up

version: 2
updates:

# Maintain dependencies for Ruby
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
Expand Down
29 changes: 29 additions & 0 deletions mruby/.github/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
benchmark:
- benchmark/**/*
build:
- Makefile
- Rakefile
- build_config/**/*
- lib/**/*
- tasks/**/*
core:
- include/**/*
- mrblib/**/*
- src/**/*
- test/**/*
doc:
- CONTRIBUTING.md
- LEGAL
- LICENSE
- NEWS
- README.md
- SECURITY.md
- TODO.md
- doc/**/*
- examples/**/*
github:
- .github/**/*
mrbgems:
- mrbgems/**/*
oss-fuzz:
- oss-fuzz/**/*
9 changes: 6 additions & 3 deletions mruby/.github/linters/.markdown-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
# MD001 heading-increment/header-increment - Heading levels should only increment by one level at a time
MD001: false

# MD010 no-hard-tabs - Hard tabs
MD010: false

# MD013 line-length - Line length
MD013: false

Expand All @@ -22,5 +19,11 @@ MD025: false
# MD026 no-trailing-punctuation - Trailing punctuation in heading
MD026: false

# MD033/no-inline-html - Inline HTML
MD033: false

# MD040 fenced-code-language - Fenced code blocks should have a language specified
MD040: false

# MD041 first-line-heading/first-line-h1 - First line in a file should be a top-level heading
MD041: false
Loading

0 comments on commit 3f41c72

Please sign in to comment.