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
650a504b
Commit
650a504b
authored
13 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
sws: don't enable pipelining for requests with content-length
Log texts also modified and some white space edits
parent
e3a9804d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/server/sws.c
+34
-16
34 additions, 16 deletions
tests/server/sws.c
with
34 additions
and
16 deletions
tests/server/sws.c
+
34
−
16
View file @
650a504b
...
...
@@ -117,6 +117,7 @@ struct httprequest {
int
rcmd
;
/* doing a special command, see defines above */
int
prot_version
;
/* HTTP version * 10 */
bool
pipelining
;
/* true if request is pipelined */
int
callcount
;
/* times ProcessRequest() gets called */
};
static
int
ProcessRequest
(
struct
httprequest
*
req
);
...
...
@@ -308,13 +309,16 @@ static int ProcessRequest(struct httprequest *req)
bool
chunked
=
FALSE
;
static
char
request
[
REQUEST_KEYWORD_SIZE
];
static
char
doc
[
MAXDOCNAMELEN
];
char
logbuf
[
2
56
];
char
logbuf
[
4
56
];
int
prot_major
,
prot_minor
;
char
*
end
;
int
error
;
end
=
strstr
(
line
,
end_of_headers
);
logmsg
(
"ProcessRequest() called"
);
req
->
callcount
++
;
logmsg
(
"Process %d bytes request%s"
,
req
->
offset
,
req
->
callcount
>
1
?
" [CONTINUED]"
:
""
);
/* try to figure out the request characteristics as soon as possible, but
only once! */
...
...
@@ -346,7 +350,7 @@ static int ProcessRequest(struct httprequest *req)
FILE
*
stream
;
char
*
filename
;
if
((
strlen
(
doc
)
+
strlen
(
request
))
<
2
00
)
if
((
strlen
(
doc
)
+
strlen
(
request
))
<
4
00
)
sprintf
(
logbuf
,
"Got request: %s %s HTTP/%d.%d"
,
request
,
doc
,
prot_major
,
prot_minor
);
else
...
...
@@ -500,13 +504,17 @@ static int ProcessRequest(struct httprequest *req)
}
}
}
else
if
((
req
->
offset
>=
3
)
&&
(
req
->
testno
==
DOCNUMBER_NOTHING
))
{
logmsg
(
"** Unusual request. Starts with %02x %02x %02x"
,
line
[
0
],
line
[
1
],
line
[
2
]);
}
if
(
!
end
)
{
/* we don't have a complete request yet! */
logmsg
(
"
ProcessRequest returned without a
complete
reques
t"
);
logmsg
(
"
request not
complete
ye
t"
);
return
0
;
/* not complete yet */
}
logmsg
(
"
ProcessR
equest found
a
complete
request
"
);
logmsg
(
"
- r
equest found
to be
complete"
);
if
(
use_gopher
)
{
/* when using gopher we cannot check the request until the entire
...
...
@@ -635,10 +643,11 @@ static int ProcessRequest(struct httprequest *req)
req
->
ntlm
=
TRUE
;
/* NTLM found */
logmsg
(
"Received NTLM type-1, sending back data %ld"
,
req
->
partno
);
}
else
if
((
req
->
partno
>=
1000
)
&&
strstr
(
req
->
reqbuf
,
"Authorization: Basic"
))
{
/* If the client is passing this Basic-header and the part number is already
>=1000, we add 1 to the part number. This allows simple Basic authentication
negotiation to work in the test suite. */
else
if
((
req
->
partno
>=
1000
)
&&
strstr
(
req
->
reqbuf
,
"Authorization: Basic"
))
{
/* If the client is passing this Basic-header and the part number is
already >=1000, we add 1 to the part number. This allows simple Basic
authentication negotiation to work in the test suite. */
req
->
partno
+=
1
;
logmsg
(
"Received Basic request, sending back data %ld"
,
req
->
partno
);
}
...
...
@@ -650,6 +659,7 @@ static int ProcessRequest(struct httprequest *req)
req
->
prot_version
>=
11
&&
end
&&
req
->
reqbuf
+
req
->
offset
>
end
+
strlen
(
end_of_headers
)
&&
!
req
->
cl
&&
(
!
strncmp
(
req
->
reqbuf
,
"GET"
,
strlen
(
"GET"
))
||
!
strncmp
(
req
->
reqbuf
,
"HEAD"
,
strlen
(
"HEAD"
))))
{
/* If we have a persistent connection, HTTP version >= 1.1
...
...
@@ -674,8 +684,10 @@ static int ProcessRequest(struct httprequest *req)
makes the server NOT wait for PUT/POST data and you can then make the
test case send a rejection before any such data has been sent. Test case
154 uses this.*/
if
(
req
->
auth_req
&&
!
req
->
auth
)
if
(
req
->
auth_req
&&
!
req
->
auth
)
{
logmsg
(
"Return early due to auth requested by none provided"
);
return
1
;
/* done */
}
if
(
req
->
cl
>
0
)
{
if
(
req
->
cl
<=
req
->
offset
-
(
end
-
req
->
reqbuf
)
-
strlen
(
end_of_headers
))
...
...
@@ -775,6 +787,7 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
req
->
rcmd
=
RCMD_NORMALREQ
;
req
->
prot_version
=
0
;
req
->
pipelining
=
FALSE
;
req
->
callcount
=
0
;
/*** end of httprequest init ***/
...
...
@@ -786,9 +799,9 @@ static int get_request(curl_socket_t sock, struct httprequest *req)
}
else
{
if
(
req
->
skip
)
/* we are instructed to not read the entire thing, so we make sure to
only
read what we're supposed to and NOT read the enire thing the
client
wants to send! */
/* we are instructed to not read the entire thing, so we make sure to
only
read what we're supposed to and NOT read the enire thing the
client
wants to send! */
got
=
sread
(
sock
,
reqbuf
+
req
->
offset
,
req
->
cl
);
else
got
=
sread
(
sock
,
reqbuf
+
req
->
offset
,
REQBUFSIZ
-
1
-
req
->
offset
);
...
...
@@ -870,7 +883,7 @@ static int send_doc(curl_socket_t sock, struct httprequest *req)
char
partbuf
[
80
]
=
"data"
;
logmsg
(
"Send response
number %ld part
%ld"
,
req
->
testno
,
req
->
partno
);
logmsg
(
"Send response
test%ld section <data
%ld
>
"
,
req
->
testno
,
req
->
partno
);
switch
(
req
->
rcmd
)
{
default:
...
...
@@ -1413,8 +1426,13 @@ int main(int argc, char *argv[])
break
;
}
if
(
req
.
open
)
logmsg
(
"=> persistant connection request ended, awaits new request"
);
if
(
req
.
open
)
{
logmsg
(
"=> persistant connection request ended, awaits new request
\n
"
);
/*
const char *keepopen="[KEEPING CONNECTION OPEN]";
storerequest((char *)keepopen, strlen(keepopen));
*/
}
/* if we got a CONNECT, loop and get another request as well! */
}
while
(
req
.
open
||
(
req
.
testno
==
DOCNUMBER_CONNECT
));
...
...
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