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
1835bda0
Commit
1835bda0
authored
Nov 01, 2013
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nghttp, nghttpd: Add --color option to force colored log output
parent
9ee468ce
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
5 deletions
+19
-5
src/nghttp.cc
src/nghttp.cc
+10
-3
src/nghttpd.cc
src/nghttpd.cc
+9
-2
No files found.
src/nghttp.cc
View file @
1835bda0
...
...
@@ -1619,12 +1619,14 @@ void print_help(std::ostream& out)
<<
" is large enough as it is seen as unlimited.
\n
"
<<
" -c, --header-table-size=<N>
\n
"
<<
" Specify decoder header table size.
\n
"
<<
" --color Force colored log output.
\n
"
<<
std
::
endl
;
}
}
// namespace
int
main
(
int
argc
,
char
**
argv
)
{
bool
color
=
false
;
while
(
1
)
{
int
flag
=
0
;
static
option
long_options
[]
=
{
...
...
@@ -1636,8 +1638,6 @@ int main(int argc, char **argv)
{
"connection-window-bits"
,
required_argument
,
nullptr
,
'W'
},
{
"get-assets"
,
no_argument
,
nullptr
,
'a'
},
{
"stat"
,
no_argument
,
nullptr
,
's'
},
{
"cert"
,
required_argument
,
&
flag
,
1
},
{
"key"
,
required_argument
,
&
flag
,
2
},
{
"help"
,
no_argument
,
nullptr
,
'h'
},
{
"header"
,
required_argument
,
nullptr
,
'H'
},
{
"data"
,
required_argument
,
nullptr
,
'd'
},
...
...
@@ -1647,6 +1647,9 @@ int main(int argc, char **argv)
{
"pri"
,
required_argument
,
nullptr
,
'p'
},
{
"peer-max-concurrent-streams"
,
required_argument
,
nullptr
,
'M'
},
{
"header-table-size"
,
required_argument
,
nullptr
,
'c'
},
{
"cert"
,
required_argument
,
&
flag
,
1
},
{
"key"
,
required_argument
,
&
flag
,
2
},
{
"color"
,
no_argument
,
&
flag
,
3
},
{
nullptr
,
0
,
nullptr
,
0
}
};
int
option_index
=
0
;
...
...
@@ -1774,6 +1777,10 @@ int main(int argc, char **argv)
// key option
config
.
keyfile
=
optarg
;
break
;
case
3
:
// color option
color
=
true
;
break
;
}
break
;
default:
...
...
@@ -1781,7 +1788,7 @@ int main(int argc, char **argv)
}
}
set_color_output
(
isatty
(
fileno
(
stdout
)));
set_color_output
(
color
||
isatty
(
fileno
(
stdout
)));
struct
sigaction
act
;
memset
(
&
act
,
0
,
sizeof
(
struct
sigaction
));
...
...
src/nghttpd.cc
View file @
1835bda0
...
...
@@ -76,6 +76,7 @@ void print_help(std::ostream& out)
<<
" -f, --no-flow-control
\n
"
<<
" Disables connection and stream level flow
\n
"
<<
" controls.
\n
"
<<
" --color Force colored log output.
\n
"
<<
" -h, --help Print this help.
\n
"
<<
std
::
endl
;
}
...
...
@@ -84,6 +85,7 @@ void print_help(std::ostream& out)
int
main
(
int
argc
,
char
**
argv
)
{
Config
config
;
bool
color
=
false
;
while
(
1
)
{
int
flag
=
0
;
static
option
long_options
[]
=
{
...
...
@@ -92,8 +94,9 @@ int main(int argc, char **argv)
{
"help"
,
no_argument
,
nullptr
,
'h'
},
{
"verbose"
,
no_argument
,
nullptr
,
'v'
},
{
"verify-client"
,
no_argument
,
nullptr
,
'V'
},
{
"no-tls"
,
no_argument
,
&
flag
,
1
},
{
"no-flow-control"
,
no_argument
,
nullptr
,
'f'
},
{
"no-tls"
,
no_argument
,
&
flag
,
1
},
{
"color"
,
no_argument
,
&
flag
,
2
},
{
nullptr
,
0
,
nullptr
,
0
}
};
int
option_index
=
0
;
...
...
@@ -128,6 +131,10 @@ int main(int argc, char **argv)
// no-tls option
config
.
no_tls
=
true
;
break
;
case
2
:
// color option
color
=
true
;
break
;
}
break
;
default:
...
...
@@ -162,7 +169,7 @@ int main(int argc, char **argv)
config
.
htdocs
=
"./"
;
}
set_color_output
(
isatty
(
fileno
(
stdout
)));
set_color_output
(
color
||
isatty
(
fileno
(
stdout
)));
struct
sigaction
act
;
memset
(
&
act
,
0
,
sizeof
(
struct
sigaction
));
...
...
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