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
abfc100e
Commit
abfc100e
authored
Feb 28, 2012
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added convenient function spdylay_frame_nv_norm_copy()
parent
e79de111
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
27 additions
and
15 deletions
+27
-15
lib/spdylay_frame.c
lib/spdylay_frame.c
+11
-0
lib/spdylay_frame.h
lib/spdylay_frame.h
+11
-0
lib/spdylay_submit.c
lib/spdylay_submit.c
+4
-12
tests/spdylay_frame_test.c
tests/spdylay_frame_test.c
+1
-3
No files found.
lib/spdylay_frame.c
View file @
abfc100e
...
...
@@ -397,6 +397,17 @@ void spdylay_frame_nv_downcase(char **nv)
}
}
char
**
spdylay_frame_nv_norm_copy
(
const
char
**
nv
)
{
char
**
nv_copy
;
nv_copy
=
spdylay_frame_nv_copy
(
nv
);
if
(
nv_copy
!=
NULL
)
{
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
}
return
nv_copy
;
}
void
spdylay_frame_syn_stream_init
(
spdylay_syn_stream
*
frame
,
uint16_t
version
,
uint8_t
flags
,
int32_t
stream_id
,
int32_t
assoc_stream_id
,
...
...
lib/spdylay_frame.h
View file @
abfc100e
...
...
@@ -536,6 +536,17 @@ void spdylay_frame_nv_sort(char **nv);
*/
void
spdylay_frame_nv_downcase
(
char
**
nv
);
/*
* This function first makes a copy of |nv| using
* spdylay_frame_nv_copy(). If it succeeds, then call
* spdylay_frame_nv_downcase() and spdylay_frame_nv_sort() with the
* copied name/value pairs.
*
* This function returns the copied name/value pairs if it succeeds,
* or NULL.
*/
char
**
spdylay_frame_nv_norm_copy
(
const
char
**
nv
);
/*
* Makes copy of |iv| and return the copy. The |niv| is the number of
* entries in |iv|. This function returns the pointer to the copy if
...
...
lib/spdylay_submit.c
View file @
abfc100e
...
...
@@ -69,15 +69,13 @@ static int spdylay_submit_syn_stream_shared
free
(
data_prd_copy
);
return
SPDYLAY_ERR_NOMEM
;
}
nv_copy
=
spdylay_frame_nv_copy
(
nv
);
nv_copy
=
spdylay_frame_nv_
norm_
copy
(
nv
);
if
(
nv_copy
==
NULL
)
{
free
(
frame
);
free
(
aux_data
);
free
(
data_prd_copy
);
return
SPDYLAY_ERR_NOMEM
;
}
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
flags_copy
=
0
;
if
(
flags
&
SPDYLAY_CTRL_FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_CTRL_FLAG_FIN
;
...
...
@@ -118,13 +116,11 @@ int spdylay_submit_syn_reply(spdylay_session *session, uint8_t flags,
if
(
frame
==
NULL
)
{
return
SPDYLAY_ERR_NOMEM
;
}
nv_copy
=
spdylay_frame_nv_copy
(
nv
);
nv_copy
=
spdylay_frame_nv_
norm_
copy
(
nv
);
if
(
nv_copy
==
NULL
)
{
free
(
frame
);
return
SPDYLAY_ERR_NOMEM
;
}
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
flags_copy
=
0
;
if
(
flags
&
SPDYLAY_CTRL_FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_CTRL_FLAG_FIN
;
...
...
@@ -150,13 +146,11 @@ int spdylay_submit_headers(spdylay_session *session, uint8_t flags,
if
(
frame
==
NULL
)
{
return
SPDYLAY_ERR_NOMEM
;
}
nv_copy
=
spdylay_frame_nv_copy
(
nv
);
nv_copy
=
spdylay_frame_nv_
norm_
copy
(
nv
);
if
(
nv_copy
==
NULL
)
{
free
(
frame
);
return
SPDYLAY_ERR_NOMEM
;
}
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
flags_copy
=
0
;
if
(
flags
&
SPDYLAY_CTRL_FLAG_FIN
)
{
flags_copy
|=
SPDYLAY_CTRL_FLAG_FIN
;
...
...
@@ -224,14 +218,12 @@ int spdylay_submit_response(spdylay_session *session,
free
(
data_prd_copy
);
return
SPDYLAY_ERR_NOMEM
;
}
nv_copy
=
spdylay_frame_nv_copy
(
nv
);
nv_copy
=
spdylay_frame_nv_
norm_
copy
(
nv
);
if
(
nv_copy
==
NULL
)
{
free
(
frame
);
free
(
data_prd_copy
);
return
SPDYLAY_ERR_NOMEM
;
}
spdylay_frame_nv_downcase
(
nv_copy
);
spdylay_frame_nv_sort
(
nv_copy
);
if
(
data_prd_copy
==
NULL
)
{
flags
|=
SPDYLAY_CTRL_FLAG_FIN
;
}
...
...
tests/spdylay_frame_test.c
View file @
abfc100e
...
...
@@ -83,9 +83,7 @@ void test_spdylay_frame_pack_nv_duplicate_keys()
"version"
,
"HTTP/1.1"
,
NULL
};
char
**
nv
=
spdylay_frame_nv_copy
(
nv_src
);
spdylay_frame_nv_downcase
(
nv
);
spdylay_frame_nv_sort
(
nv
);
char
**
nv
=
spdylay_frame_nv_norm_copy
(
nv_src
);
/* size_t inlen = */
spdylay_frame_pack_nv
(
out
,
nv
,
len_size
);
const
uint8_t
*
outptr
=
out
;
int
pairs
=
spdylay_get_uint16
(
outptr
);
...
...
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