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
ec24efda
Commit
ec24efda
authored
22 years ago
by
Daniel Stenberg
Browse files
Options
Downloads
Patches
Plain Diff
Simon Liu's HTTP200ALIASES-patch!
parent
7f0f10e4
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
include/curl/curl.h
+3
-0
3 additions, 0 deletions
include/curl/curl.h
lib/transfer.c
+36
-2
36 additions, 2 deletions
lib/transfer.c
lib/url.c
+7
-0
7 additions, 0 deletions
lib/url.c
lib/urldata.h
+2
-0
2 additions, 0 deletions
lib/urldata.h
with
48 additions
and
2 deletions
include/curl/curl.h
+
3
−
0
View file @
ec24efda
...
...
@@ -616,6 +616,9 @@ typedef enum {
/* Set pointer to private data */
CINIT
(
PRIVATE
,
OBJECTPOINT
,
103
),
/* Set aliases for HTTP 200 in the HTTP Response header */
CINIT
(
HTTP200ALIASES
,
OBJECTPOINT
,
104
),
CURLOPT_LASTENTRY
/* the last unused */
}
CURLoption
;
...
...
This diff is collapsed.
Click to expand it.
lib/transfer.c
+
36
−
2
View file @
ec24efda
...
...
@@ -162,6 +162,28 @@ static int fillbuffer(struct connectdata *conn,
return
nread
;
}
/*
* checkhttpprefix()
*
* Returns TRUE if member of the list matches prefix of string
*/
static
bool
checkhttpprefix
(
struct
SessionHandle
*
data
,
const
char
*
s
)
{
struct
curl_slist
*
head
=
data
->
set
.
http200aliases
;
while
(
head
)
{
if
(
checkprefix
(
head
->
data
,
s
))
return
TRUE
;
head
=
head
->
next
;
}
if
(
checkprefix
(
"HTTP/"
,
s
))
return
TRUE
;
return
FALSE
;
}
CURLcode
Curl_readwrite
(
struct
connectdata
*
conn
,
bool
*
done
)
...
...
@@ -287,7 +309,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
k
->
hbuflen
+=
nread
;
if
(
!
k
->
headerline
&&
(
k
->
hbuflen
>
5
))
{
/* make a first check that this looks like a HTTP header */
if
(
!
checkprefix
(
"HTTP/"
,
data
->
state
.
headerbuff
))
{
if
(
!
check
http
prefix
(
data
,
data
->
state
.
headerbuff
))
{
/* this is not the beginning of a HTTP first header line */
k
->
header
=
FALSE
;
k
->
badheader
=
HEADER_ALLBAD
;
...
...
@@ -341,7 +363,7 @@ CURLcode Curl_readwrite(struct connectdata *conn,
if
(
!
k
->
headerline
)
{
/* the first read header */
if
((
k
->
hbuflen
>
5
)
&&
!
checkprefix
(
"HTTP/"
,
data
->
state
.
headerbuff
))
{
!
check
http
prefix
(
data
,
data
->
state
.
headerbuff
))
{
/* this is not the beginning of a HTTP first header line */
k
->
header
=
FALSE
;
k
->
badheader
=
HEADER_PARTHEADER
;
...
...
@@ -468,6 +490,18 @@ CURLcode Curl_readwrite(struct connectdata *conn,
*/
nc
=
sscanf
(
k
->
p
,
" HTTP %3d"
,
&
k
->
httpcode
);
k
->
httpversion
=
10
;
/* If user has set option HTTP200ALIASES,
compare header line against list of aliases
*/
if
(
!
nc
)
{
if
(
checkhttpprefix
(
data
,
k
->
p
))
{
nc
=
1
;
k
->
httpcode
=
200
;
k
->
httpversion
=
(
data
->
set
.
httpversion
==
CURL_HTTP_VERSION_1_0
)
?
10
:
11
;
}
}
}
if
(
nc
)
{
...
...
This diff is collapsed.
Click to expand it.
lib/url.c
+
7
−
0
View file @
ec24efda
...
...
@@ -1095,6 +1095,13 @@ CURLcode Curl_setopt(struct SessionHandle *data, CURLoption option, ...)
data
->
set
.
private
=
va_arg
(
param
,
char
*
);
break
;
case
CURLOPT_HTTP200ALIASES
:
/*
* Set a list of aliases for HTTP 200 in response header
*/
data
->
set
.
http200aliases
=
va_arg
(
param
,
struct
curl_slist
*
);
break
;
default:
/* unknown tag and its companion, just ignore: */
return
CURLE_FAILED_INIT
;
/* correct this */
...
...
This diff is collapsed.
Click to expand it.
lib/urldata.h
+
2
−
0
View file @
ec24efda
...
...
@@ -715,6 +715,8 @@ struct UserDefined {
long
buffer_size
;
/* size of receive buffer to use */
char
*
private
;
/* Private data */
struct
curl_slist
*
http200aliases
;
/* linked list of aliases for http200 */
/* Here follows boolean settings that define how to behave during
this session. They are STATIC, set by libcurl users or at least initially
...
...
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