Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
TLMSP curl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CYBER - Cyber Security
TS 103 523 MSP
TLMSP
TLMSP curl
Commits
48c3bed4
Commit
48c3bed4
authored
11 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
http2: add CRLF when first data arrives
parent
1c9aaa0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
lib/http.h
+1
-1
1 addition, 1 deletion
lib/http.h
lib/http2.c
+14
-4
14 additions, 4 deletions
lib/http2.c
with
15 additions
and
5 deletions
lib/http.h
+
1
−
1
View file @
48c3bed4
...
...
@@ -157,7 +157,7 @@ struct http_conn {
size_t
binlen
;
/* length of the binsettings data */
char
*
mem
;
/* points to a buffer in memory to store or read from */
size_t
len
;
/* size of the buffer 'mem' points to */
ssize_t
nread
;
/* how much data that was sent/recv by the HTTP2 engine */
bool
bodystarted
;
#else
int
unused
;
/* prevent a compiler warning */
#endif
...
...
This diff is collapsed.
Click to expand it.
lib/http2.c
+
14
−
4
View file @
48c3bed4
...
...
@@ -138,13 +138,21 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
infof
(
conn
->
data
,
"on_data_chunk_recv() "
"len = %u, stream = %x
\n
"
,
len
,
stream_id
);
if
(
!
c
->
bodystarted
)
{
memcpy
(
c
->
mem
,
"
\r\n
"
,
2
);
/* signal end of headers */
c
->
mem
+=
2
;
c
->
len
-=
2
;
c
->
bodystarted
=
TRUE
;
}
if
(
len
<
c
->
len
)
{
memcpy
(
c
->
mem
,
data
,
len
);
c
->
mem
+=
len
;
c
->
len
-=
len
;
}
else
{
infof
(
conn
->
data
,
"EEEEEEK
\n
"
);
infof
(
conn
->
data
,
"EEEEEEK: %d > %d
\n
"
,
len
,
c
->
len
);
/* return NGHTTP2_ERR_PAUSE; */
}
return
0
;
...
...
@@ -242,7 +250,6 @@ static int on_header(nghttp2_session *session, const nghttp2_frame *frame,
c
->
mem
[
namelen
+
valuelen
+
2
]
=
'\n'
;
c
->
mem
[
namelen
+
valuelen
+
3
]
=
0
;
/* to display this easier */
}
infof
(
conn
->
data
,
"Got %s"
,
c
->
mem
);
c
->
mem
+=
hlen
;
c
->
len
-=
hlen
;
...
...
@@ -366,7 +373,8 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
conn
->
proto
.
httpc
.
mem
=
mem
;
conn
->
proto
.
httpc
.
len
=
len
;
infof
(
conn
->
data
,
"http2_recv
\n
"
);
infof
(
conn
->
data
,
"http2_recv: %d bytes buffer
\n
"
,
conn
->
proto
.
httpc
.
len
);
for
(;;)
{
rc
=
Curl_read_plain
(
conn
->
sock
[
FIRSTSOCKET
],
inbuf
,
H2_BUFSIZE
,
&
nread
);
...
...
@@ -383,7 +391,7 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
*
err
=
CURLE_RECV_ERROR
;
return
0
;
}
infof
(
conn
->
data
,
"nread=%zd
\n
"
,
nread
);
if
(
!
nread
)
{
*
err
=
CURLE_RECV_ERROR
;
return
0
;
/* TODO EOF? */
...
...
@@ -401,6 +409,7 @@ static ssize_t http2_recv(struct connectdata *conn, int sockindex,
/* Happens when NGHTTP2_ERR_PAUSE is returned from user callback */
break
;
}
break
;
}
return
len
-
conn
->
proto
.
httpc
.
len
;
}
...
...
@@ -427,6 +436,7 @@ int Curl_http2_switched(struct connectdata *conn)
conn
->
recv
[
FIRSTSOCKET
]
=
http2_recv
;
conn
->
send
[
FIRSTSOCKET
]
=
http2_send
;
infof
(
conn
->
data
,
"We have switched to HTTP2
\n
"
);
httpc
->
bodystarted
=
FALSE
;
/* send the SETTINGS frame (again) */
rc
=
nghttp2_session_upgrade
(
httpc
->
h2
,
httpc
->
binsettings
,
httpc
->
binlen
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment