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
f2d94573
Commit
f2d94573
authored
Apr 01, 2014
by
Tatsuhiro Tsujikawa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename framebuflen as framerv, cause it is not a length
parent
f5ead55f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
66 additions
and
66 deletions
+66
-66
lib/nghttp2_session.c
lib/nghttp2_session.c
+60
-60
lib/nghttp2_session.h
lib/nghttp2_session.h
+6
-6
No files found.
lib/nghttp2_session.c
View file @
f2d94573
...
@@ -1476,7 +1476,7 @@ static int session_headers_add_pad(nghttp2_session *session,
...
@@ -1476,7 +1476,7 @@ static int session_headers_add_pad(nghttp2_session *session,
static
int
nghttp2_session_prep_frame
(
nghttp2_session
*
session
,
static
int
nghttp2_session_prep_frame
(
nghttp2_session
*
session
,
nghttp2_outbound_item
*
item
)
nghttp2_outbound_item
*
item
)
{
{
ssize_t
frame
buflen
=
0
;
ssize_t
frame
rv
=
0
;
int
rv
;
int
rv
;
if
(
item
->
frame_cat
==
NGHTTP2_CAT_CTRL
)
{
if
(
item
->
frame_cat
==
NGHTTP2_CAT_CTRL
)
{
...
@@ -1519,20 +1519,20 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1519,20 +1519,20 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
return
rv
;
return
rv
;
}
}
}
}
frame
buflen
=
nghttp2_frame_pack_headers
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_headers
(
&
session
->
aob
.
framebufs
,
&
frame
->
headers
,
&
frame
->
headers
,
&
session
->
hd_deflater
);
&
session
->
hd_deflater
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
DEBUGF
(
fprintf
(
stderr
,
DEBUGF
(
fprintf
(
stderr
,
"send: before padding, HEADERS serialized in %zd bytes
\n
"
,
"send: before padding, HEADERS serialized in %zd bytes
\n
"
,
nghttp2_bufs_len
(
&
session
->
aob
.
framebufs
)));
nghttp2_bufs_len
(
&
session
->
aob
.
framebufs
)));
frame
buflen
=
session_headers_add_pad
(
session
,
frame
);
frame
rv
=
session_headers_add_pad
(
session
,
frame
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
switch
(
frame
->
headers
.
cat
)
{
switch
(
frame
->
headers
.
cat
)
{
...
@@ -1568,18 +1568,18 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1568,18 +1568,18 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
if
(
rv
!=
0
)
{
if
(
rv
!=
0
)
{
return
rv
;
return
rv
;
}
}
frame
buflen
=
nghttp2_frame_pack_priority
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_priority
(
&
session
->
aob
.
framebufs
,
&
frame
->
priority
);
&
frame
->
priority
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
}
}
case
NGHTTP2_RST_STREAM
:
case
NGHTTP2_RST_STREAM
:
frame
buflen
=
nghttp2_frame_pack_rst_stream
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_rst_stream
(
&
session
->
aob
.
framebufs
,
&
frame
->
rst_stream
);
&
frame
->
rst_stream
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
case
NGHTTP2_SETTINGS
:
{
case
NGHTTP2_SETTINGS
:
{
...
@@ -1587,10 +1587,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1587,10 +1587,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
if
(
rv
!=
0
)
{
if
(
rv
!=
0
)
{
return
rv
;
return
rv
;
}
}
frame
buflen
=
nghttp2_frame_pack_settings
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_settings
(
&
session
->
aob
.
framebufs
,
&
frame
->
settings
);
&
frame
->
settings
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
}
}
...
@@ -1608,15 +1608,15 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1608,15 +1608,15 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
}
}
frame
->
push_promise
.
promised_stream_id
=
session
->
next_stream_id
;
frame
->
push_promise
.
promised_stream_id
=
session
->
next_stream_id
;
session
->
next_stream_id
+=
2
;
session
->
next_stream_id
+=
2
;
frame
buflen
=
nghttp2_frame_pack_push_promise
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_push_promise
(
&
session
->
aob
.
framebufs
,
&
frame
->
push_promise
,
&
frame
->
push_promise
,
&
session
->
hd_deflater
);
&
session
->
hd_deflater
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
frame
buflen
=
session_headers_add_pad
(
session
,
frame
);
frame
rv
=
session_headers_add_pad
(
session
,
frame
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
stream
=
nghttp2_session_get_stream
(
session
,
frame
->
hd
.
stream_id
);
stream
=
nghttp2_session_get_stream
(
session
,
frame
->
hd
.
stream_id
);
...
@@ -1638,10 +1638,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1638,10 +1638,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
break
;
break
;
}
}
case
NGHTTP2_PING
:
case
NGHTTP2_PING
:
frame
buflen
=
nghttp2_frame_pack_ping
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_ping
(
&
session
->
aob
.
framebufs
,
&
frame
->
ping
);
&
frame
->
ping
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
case
NGHTTP2_WINDOW_UPDATE
:
{
case
NGHTTP2_WINDOW_UPDATE
:
{
...
@@ -1650,10 +1650,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1650,10 +1650,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
if
(
rv
!=
0
)
{
if
(
rv
!=
0
)
{
return
rv
;
return
rv
;
}
}
frame
buflen
=
nghttp2_frame_pack_window_update
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_window_update
(
&
session
->
aob
.
framebufs
,
&
frame
->
window_update
);
&
frame
->
window_update
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
}
}
...
@@ -1665,18 +1665,18 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1665,18 +1665,18 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
peer that last-stream-id. */
peer that last-stream-id. */
return
NGHTTP2_ERR_GOAWAY_ALREADY_SENT
;
return
NGHTTP2_ERR_GOAWAY_ALREADY_SENT
;
}
}
frame
buflen
=
nghttp2_frame_pack_goaway
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_goaway
(
&
session
->
aob
.
framebufs
,
&
frame
->
goaway
);
&
frame
->
goaway
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
case
NGHTTP2_ALTSVC
:
case
NGHTTP2_ALTSVC
:
frame
buflen
=
nghttp2_frame_pack_altsvc
(
&
session
->
aob
.
framebufs
,
frame
rv
=
nghttp2_frame_pack_altsvc
(
&
session
->
aob
.
framebufs
,
&
frame
->
altsvc
);
&
frame
->
altsvc
);
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
break
;
break
;
...
@@ -1724,17 +1724,17 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1724,17 +1724,17 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
nghttp2_active_outbound_item_reset
(
&
session
->
aob
);
nghttp2_active_outbound_item_reset
(
&
session
->
aob
);
return
NGHTTP2_ERR_DEFERRED
;
return
NGHTTP2_ERR_DEFERRED
;
}
}
frame
buflen
=
nghttp2_session_pack_data
(
session
,
frame
rv
=
nghttp2_session_pack_data
(
session
,
&
session
->
aob
.
framebufs
,
&
session
->
aob
.
framebufs
,
next_readmax
,
next_readmax
,
data_frame
);
data_frame
);
if
(
frame
buflen
==
NGHTTP2_ERR_DEFERRED
)
{
if
(
frame
rv
==
NGHTTP2_ERR_DEFERRED
)
{
nghttp2_stream_defer_data
(
stream
,
item
,
NGHTTP2_DEFERRED_NONE
);
nghttp2_stream_defer_data
(
stream
,
item
,
NGHTTP2_DEFERRED_NONE
);
session
->
aob
.
item
=
NULL
;
session
->
aob
.
item
=
NULL
;
nghttp2_active_outbound_item_reset
(
&
session
->
aob
);
nghttp2_active_outbound_item_reset
(
&
session
->
aob
);
return
NGHTTP2_ERR_DEFERRED
;
return
NGHTTP2_ERR_DEFERRED
;
}
}
if
(
frame
buflen
==
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
)
{
if
(
frame
rv
==
NGHTTP2_ERR_TEMPORAL_CALLBACK_FAILURE
)
{
rv
=
nghttp2_stream_detach_data
(
stream
,
&
session
->
ob_pq
);
rv
=
nghttp2_stream_detach_data
(
stream
,
&
session
->
ob_pq
);
if
(
nghttp2_is_fatal
(
rv
))
{
if
(
nghttp2_is_fatal
(
rv
))
{
...
@@ -1746,10 +1746,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
...
@@ -1746,10 +1746,10 @@ static int nghttp2_session_prep_frame(nghttp2_session *session,
if
(
rv
!=
0
)
{
if
(
rv
!=
0
)
{
return
rv
;
return
rv
;
}
}
return
frame
buflen
;
return
frame
rv
;
}
}
if
(
frame
buflen
<
0
)
{
if
(
frame
rv
<
0
)
{
return
frame
buflen
;
return
frame
rv
;
}
}
return
0
;
return
0
;
}
else
{
}
else
{
...
@@ -2161,7 +2161,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
...
@@ -2161,7 +2161,7 @@ static int nghttp2_session_after_frame_sent(nghttp2_session *session)
return
0
;
return
0
;
}
}
assert
(
rv
>
=
0
);
assert
(
rv
=
=
0
);
return
0
;
return
0
;
}
}
...
@@ -5358,10 +5358,10 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
...
@@ -5358,10 +5358,10 @@ int nghttp2_session_add_settings(nghttp2_session *session, uint8_t flags,
return
0
;
return
0
;
}
}
ssize_
t
nghttp2_session_pack_data
(
nghttp2_session
*
session
,
in
t
nghttp2_session_pack_data
(
nghttp2_session
*
session
,
nghttp2_bufs
*
bufs
,
nghttp2_bufs
*
bufs
,
size_t
datamax
,
size_t
datamax
,
nghttp2_private_data
*
frame
)
nghttp2_private_data
*
frame
)
{
{
ssize_t
rv
;
ssize_t
rv
;
int
eof_flags
;
int
eof_flags
;
...
@@ -5446,7 +5446,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
...
@@ -5446,7 +5446,7 @@ ssize_t nghttp2_session_pack_data(nghttp2_session *session,
frame
->
hd
.
flags
|=
hd
.
flags
;
frame
->
hd
.
flags
|=
hd
.
flags
;
frame
->
padlen
=
padlen
;
frame
->
padlen
=
padlen
;
return
nghttp2_buf_len
(
buf
)
;
return
0
;
}
}
void
*
nghttp2_session_get_stream_user_data
(
nghttp2_session
*
session
,
void
*
nghttp2_session_get_stream_user_data
(
nghttp2_session
*
session
,
...
...
lib/nghttp2_session.h
View file @
f2d94573
...
@@ -621,8 +621,8 @@ nghttp2_stream_group* nghttp2_session_get_stream_group
...
@@ -621,8 +621,8 @@ nghttp2_stream_group* nghttp2_session_get_stream_group
* filled using |frame->data_prd|. The length of payload is at most
* filled using |frame->data_prd|. The length of payload is at most
* |datamax| bytes.
* |datamax| bytes.
*
*
* This function returns
the size of packed frame if it succeeds, or
* This function returns
0 if it succeeds, or one of the following
*
one of the following
negative error codes:
* negative error codes:
*
*
* NGHTTP2_ERR_DEFERRED
* NGHTTP2_ERR_DEFERRED
* The DATA frame is postponed.
* The DATA frame is postponed.
...
@@ -633,10 +633,10 @@ nghttp2_stream_group* nghttp2_session_get_stream_group
...
@@ -633,10 +633,10 @@ nghttp2_stream_group* nghttp2_session_get_stream_group
* NGHTTP2_ERR_CALLBACK_FAILURE
* NGHTTP2_ERR_CALLBACK_FAILURE
* The read_callback failed (session error).
* The read_callback failed (session error).
*/
*/
ssize_
t
nghttp2_session_pack_data
(
nghttp2_session
*
session
,
in
t
nghttp2_session_pack_data
(
nghttp2_session
*
session
,
nghttp2_bufs
*
bufs
,
nghttp2_bufs
*
bufs
,
size_t
datamax
,
size_t
datamax
,
nghttp2_private_data
*
frame
);
nghttp2_private_data
*
frame
);
/*
/*
* Returns top of outbound frame queue. This function returns NULL if
* Returns top of outbound frame queue. This function returns NULL if
...
...
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