Skip to content

Commit f060689

Browse files
authored
Merge pull request unbit#2712 from xrmx/backports-2029
First batch of backport for 2.0.29
2 parents 0b07489 + 4d51792 commit f060689

File tree

4 files changed

+18
-14
lines changed

4 files changed

+18
-14
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ jobs:
5454
libpcre2-dev libjansson-dev libcap2-dev \
5555
curl
5656
- name: Install distutils
57-
if: contains(fromJson('["3.6","3.7","3.8","3.9","3.10","3.11","3.12"]'), matrix.python-version)
57+
if: contains(fromJson('["3.6","3.7","3.8","3.9","3.10","3.11"]'), matrix.python-version)
5858
run: |
5959
sudo apt install --no-install-recommends -qqyf python${{ matrix.python-version }}-distutils \
6060
- uses: actions/checkout@v4

plugins/rack/rack_plugin.c

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,18 +1055,22 @@ VALUE init_rack_app( VALUE script ) {
10551055
}
10561056
#endif
10571057

1058-
VALUE rackup = rb_funcall( rb_const_get(rack, rb_intern("Builder")), rb_intern("parse_file"), 1, script);
1059-
if (TYPE(rackup) != T_ARRAY) {
1060-
uwsgi_log("unable to parse %s file\n", RSTRING_PTR(script));
1061-
return Qnil;
1062-
}
1063-
1064-
if (RARRAY_LEN(rackup) < 1) {
1065-
uwsgi_log("invalid rack config file: %s\n", RSTRING_PTR(script));
1058+
VALUE rackup = rb_funcall( rb_const_get(rack, rb_intern("Builder")), rb_intern("parse_file"), 1, script);
1059+
if (TYPE(rackup) == T_OBJECT) { // rack +3
1060+
return rackup;
1061+
}
1062+
else if (TYPE(rackup) == T_ARRAY) { // rack << 3
1063+
if (RARRAY_LEN(rackup) < 1) {
1064+
uwsgi_log("invalid rack config file: %s\n", RSTRING_PTR(script));
1065+
return Qnil;
1066+
}
1067+
return RARRAY_PTR(rackup)[0] ;
1068+
}
1069+
else {
1070+
uwsgi_log("unable to parse %s file %d\n", RSTRING_PTR(script), TYPE(rackup));
10661071
return Qnil;
1067-
}
1072+
}
10681073

1069-
return RARRAY_PTR(rackup)[0] ;
10701074
}
10711075

10721076
int uwsgi_rack_magic(char *mountpoint, char *lazy) {

t/pypy/config.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ plugin = pypy
33
need-app = false
44
pypy-lib = /usr/lib/x86_64-linux-gnu/libpypy3-c.so
55
pypy-home = /usr/lib/pypy3
6-
pypy-setup = plugins/pypy/pypy_setup.py
7-
pypy-wsgi-file = t/python/helloapp.py
6+
pypy-setup = %d../../plugins/pypy/pypy_setup.py
7+
pypy-wsgi-file = %d../python/helloapp.py

t/rack/app.ru

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
class App
22

33
def call(environ)
4-
[200, {'Content-Type' => 'text/html'}, ['Hello']]
4+
[200, {"content-type" => "text/plain"}, ['Hello']]
55
end
66

77
end

0 commit comments

Comments
 (0)