Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
nghttp2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
nghttp2
Commits
aa3373a1
Commit
aa3373a1
authored
Feb 14, 2016
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttpx: Use ImmutableString for mruby_file
parent
7aabc6b1
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
12 additions
and
12 deletions
+12
-12
src/shrpx_config.cc
src/shrpx_config.cc
+1
-1
src/shrpx_config.h
src/shrpx_config.h
+1
-1
src/shrpx_mruby.cc
src/shrpx_mruby.cc
+5
-6
src/shrpx_mruby.h
src/shrpx_mruby.h
+4
-2
src/shrpx_worker.cc
src/shrpx_worker.cc
+1
-2
No files found.
src/shrpx_config.cc
View file @
aa3373a1
...
...
@@ -2205,7 +2205,7 @@ int parse_config(const char *opt, const char *optarg,
case
SHRPX_OPTID_MRUBY_FILE
:
#ifdef HAVE_MRUBY
mod_config
()
->
mruby_file
=
strcopy
(
optarg
)
;
mod_config
()
->
mruby_file
=
optarg
;
#else // !HAVE_MRUBY
LOG
(
WARN
)
<<
opt
<<
": ignored because mruby support is disabled at build time."
;
...
...
src/shrpx_config.h
View file @
aa3373a1
...
...
@@ -584,7 +584,7 @@ struct Config {
ImmutableString
pid_file
;
ImmutableString
conf_path
;
ImmutableString
user
;
std
::
unique_ptr
<
char
[]
>
mruby_file
;
ImmutableString
mruby_file
;
char
**
original_argv
;
char
**
argv
;
char
*
cwd
;
...
...
src/shrpx_mruby.cc
View file @
aa3373a1
...
...
@@ -31,7 +31,6 @@
#include "shrpx_config.h"
#include "shrpx_mruby_module.h"
#include "shrpx_downstream_connection.h"
#include "template.h"
namespace
shrpx
{
...
...
@@ -146,12 +145,12 @@ mrb_value instantiate_app(mrb_state *mrb, RProc *proc) {
// very hard to write these kind of code because mruby has almost no
// documentation aobut compiling or generating code, at least at the
// time of this writing.
RProc
*
compile
(
mrb_state
*
mrb
,
const
char
*
filename
)
{
if
(
filename
==
nullptr
)
{
RProc
*
compile
(
mrb_state
*
mrb
,
const
StringRef
&
filename
)
{
if
(
filename
.
empty
()
)
{
return
nullptr
;
}
auto
infile
=
fopen
(
filename
,
"rb"
);
auto
infile
=
fopen
(
filename
.
c_str
()
,
"rb"
);
if
(
infile
==
nullptr
)
{
return
nullptr
;
}
...
...
@@ -185,8 +184,8 @@ RProc *compile(mrb_state *mrb, const char *filename) {
return
proc
;
}
std
::
unique_ptr
<
MRubyContext
>
create_mruby_context
(
const
char
*
filename
)
{
if
(
!
filename
)
{
std
::
unique_ptr
<
MRubyContext
>
create_mruby_context
(
const
StringRef
&
filename
)
{
if
(
filename
.
empty
()
)
{
return
make_unique
<
MRubyContext
>
(
nullptr
,
mrb_nil_value
(),
mrb_nil_value
());
}
...
...
src/shrpx_mruby.h
View file @
aa3373a1
...
...
@@ -32,6 +32,8 @@
#include <mruby.h>
#include <mruby/proc.h>
#include "template.h"
using
namespace
nghttp2
;
namespace
shrpx
{
...
...
@@ -69,9 +71,9 @@ struct MRubyAssocData {
bool
response_headers_dirty
;
};
RProc
*
compile
(
mrb_state
*
mrb
,
const
char
*
filename
);
RProc
*
compile
(
mrb_state
*
mrb
,
const
StringRef
&
filename
);
std
::
unique_ptr
<
MRubyContext
>
create_mruby_context
(
const
char
*
filename
);
std
::
unique_ptr
<
MRubyContext
>
create_mruby_context
(
const
StringRef
&
filename
);
// Return interned |ptr|.
mrb_sym
intern_ptr
(
mrb_state
*
mrb
,
void
*
ptr
);
...
...
src/shrpx_worker.cc
View file @
aa3373a1
...
...
@@ -290,8 +290,7 @@ std::mt19937 &Worker::get_randgen() { return randgen_; }
#ifdef HAVE_MRUBY
int
Worker
::
create_mruby_context
()
{
auto
mruby_file
=
get_config
()
->
mruby_file
.
get
();
mruby_ctx_
=
mruby
::
create_mruby_context
(
mruby_file
);
mruby_ctx_
=
mruby
::
create_mruby_context
(
StringRef
{
get_config
()
->
mruby_file
});
if
(
!
mruby_ctx_
)
{
return
-
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment