Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
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
videolan
vlc
Commits
4adb5fc7
Commit
4adb5fc7
authored
Jan 05, 2016
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
http: add parameter for proxied requests
parent
90c07084
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
12 deletions
+27
-12
modules/access/http/conn.h
modules/access/http/conn.h
+1
-1
modules/access/http/connmgr.c
modules/access/http/connmgr.c
+2
-2
modules/access/http/h1conn.c
modules/access/http/h1conn.c
+4
-2
modules/access/http/h1conn_test.c
modules/access/http/h1conn_test.c
+1
-1
modules/access/http/message.c
modules/access/http/message.c
+14
-2
modules/access/http/message.h
modules/access/http/message.h
+2
-1
modules/access/http/message_test.c
modules/access/http/message_test.c
+1
-1
modules/access/http/tunnel.c
modules/access/http/tunnel.c
+2
-2
No files found.
modules/access/http/conn.h
View file @
4adb5fc7
...
...
@@ -47,7 +47,7 @@ static inline void vlc_http_conn_release(struct vlc_http_conn *conn)
conn
->
cbs
->
release
(
conn
);
}
struct
vlc_http_conn
*
vlc_h1_conn_create
(
struct
vlc_tls
*
);
struct
vlc_http_conn
*
vlc_h1_conn_create
(
struct
vlc_tls
*
,
bool
proxy
);
struct
vlc_http_conn
*
vlc_h2_conn_create
(
struct
vlc_tls
*
);
struct
vlc_http_stream
*
vlc_chunked_open
(
struct
vlc_http_stream
*
,
...
...
modules/access/http/connmgr.c
View file @
4adb5fc7
...
...
@@ -246,7 +246,7 @@ static struct vlc_http_msg *vlc_https_request(struct vlc_http_mgr *mgr,
if
(
http2
)
conn
=
vlc_h2_conn_create
(
tls
);
else
conn
=
vlc_h1_conn_create
(
tls
);
conn
=
vlc_h1_conn_create
(
tls
,
false
);
if
(
unlikely
(
conn
==
NULL
))
{
...
...
@@ -279,7 +279,7 @@ static struct vlc_http_msg *vlc_http_request(struct vlc_http_mgr *mgr,
if
(
mgr
->
use_h2c
)
conn
=
vlc_h2_conn_create
(
tls
);
else
conn
=
vlc_h1_conn_create
(
tls
);
conn
=
vlc_h1_conn_create
(
tls
,
false
);
if
(
unlikely
(
conn
==
NULL
))
{
...
...
modules/access/http/h1conn.c
View file @
4adb5fc7
...
...
@@ -114,6 +114,7 @@ struct vlc_h1_conn
bool
connection_close
;
bool
active
;
bool
released
;
bool
proxy
;
};
#define CO(conn) ((conn)->conn.tls->obj)
...
...
@@ -149,7 +150,7 @@ static struct vlc_http_stream *vlc_h1_stream_open(struct vlc_http_conn *c,
if
(
conn
->
active
||
conn
->
conn
.
tls
==
NULL
)
return
NULL
;
char
*
payload
=
vlc_http_msg_format
(
req
,
&
len
);
char
*
payload
=
vlc_http_msg_format
(
req
,
&
len
,
conn
->
proxy
);
if
(
unlikely
(
payload
==
NULL
))
return
NULL
;
...
...
@@ -312,7 +313,7 @@ static const struct vlc_http_conn_cbs vlc_h1_conn_callbacks =
vlc_h1_conn_release
,
};
struct
vlc_http_conn
*
vlc_h1_conn_create
(
vlc_tls_t
*
tls
)
struct
vlc_http_conn
*
vlc_h1_conn_create
(
vlc_tls_t
*
tls
,
bool
proxy
)
{
struct
vlc_h1_conn
*
conn
=
malloc
(
sizeof
(
*
conn
));
if
(
unlikely
(
conn
==
NULL
))
...
...
@@ -323,6 +324,7 @@ struct vlc_http_conn *vlc_h1_conn_create(vlc_tls_t *tls)
conn
->
stream
.
cbs
=
&
vlc_h1_stream_callbacks
;
conn
->
active
=
false
;
conn
->
released
=
false
;
conn
->
proxy
=
proxy
;
return
&
conn
->
conn
;
}
modules/access/http/h1conn_test.c
View file @
4adb5fc7
...
...
@@ -55,7 +55,7 @@ static void conn_create(void)
external_fd
=
fds
[
0
];
conn
=
vlc_h1_conn_create
(
tls
);
conn
=
vlc_h1_conn_create
(
tls
,
false
);
assert
(
conn
!=
NULL
);
}
...
...
modules/access/http/message.c
View file @
4adb5fc7
...
...
@@ -287,7 +287,8 @@ block_t *vlc_http_msg_read(struct vlc_http_msg *m)
/* Serialization and deserialization */
char
*
vlc_http_msg_format
(
const
struct
vlc_http_msg
*
m
,
size_t
*
restrict
lenp
)
char
*
vlc_http_msg_format
(
const
struct
vlc_http_msg
*
m
,
size_t
*
restrict
lenp
,
bool
proxied
)
{
size_t
len
;
...
...
@@ -297,6 +298,12 @@ char *vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp)
len
+=
strlen
(
m
->
method
);
len
+=
strlen
(
m
->
path
?
m
->
path
:
m
->
authority
);
len
+=
strlen
(
m
->
authority
);
if
(
proxied
)
{
assert
(
m
->
scheme
!=
NULL
&&
m
->
path
!=
NULL
);
len
+=
strlen
(
m
->
scheme
)
+
3
+
strlen
(
m
->
authority
);
}
}
else
len
=
sizeof
(
"HTTP/1.1 123 .
\r\n\r\n
"
);
...
...
@@ -311,8 +318,13 @@ char *vlc_http_msg_format(const struct vlc_http_msg *m, size_t *restrict lenp)
len
=
0
;
if
(
m
->
status
<
0
)
len
+=
sprintf
(
buf
,
"%s %s HTTP/1.1
\r\n
Host: %s
\r\n
"
,
m
->
method
,
{
len
+=
sprintf
(
buf
,
"%s "
,
m
->
method
);
if
(
proxied
)
len
+=
sprintf
(
buf
+
len
,
"%s://%s"
,
m
->
scheme
,
m
->
authority
);
len
+=
sprintf
(
buf
+
len
,
"%s HTTP/1.1
\r\n
Host: %s
\r\n
"
,
m
->
path
?
m
->
path
:
m
->
authority
,
m
->
authority
);
}
else
len
+=
sprintf
(
buf
,
"HTTP/1.1 %03hd .
\r\n
"
,
m
->
status
);
...
...
modules/access/http/message.h
View file @
4adb5fc7
...
...
@@ -252,7 +252,8 @@ static inline void vlc_http_stream_close(struct vlc_http_stream *s, bool abort)
s
->
cbs
->
close
(
s
,
abort
);
}
char
*
vlc_http_msg_format
(
const
struct
vlc_http_msg
*
m
,
size_t
*
)
VLC_USED
;
char
*
vlc_http_msg_format
(
const
struct
vlc_http_msg
*
m
,
size_t
*
restrict
lenp
,
bool
proxied
)
VLC_USED
;
struct
vlc_http_msg
*
vlc_http_msg_headers
(
const
char
*
msg
)
VLC_USED
;
struct
vlc_h2_frame
;
...
...
modules/access/http/message_test.c
View file @
4adb5fc7
...
...
@@ -115,7 +115,7 @@ static void check_msg(struct vlc_http_msg *in,
cb
(
in
);
m1
=
vlc_http_msg_format
(
in
,
&
len
);
m1
=
vlc_http_msg_format
(
in
,
&
len
,
false
);
assert
(
m1
!=
NULL
);
assert
(
strlen
(
m1
)
==
len
);
out
=
vlc_http_msg_headers
(
m1
);
...
...
modules/access/http/tunnel.c
View file @
4adb5fc7
...
...
@@ -140,8 +140,8 @@ vlc_tls_t *vlc_https_connect_proxy(vlc_tls_creds_t *creds,
if
(
session
==
NULL
)
return
NULL
;
struct
vlc_http_conn
*
conn
=
(
ptwo
?
vlc_h2_conn_create
:
vlc_h1_conn_create
)(
session
);
struct
vlc_http_conn
*
conn
=
ptwo
?
vlc_h2_conn_create
(
session
)
:
vlc_h1_conn_create
(
session
,
false
);
if
(
unlikely
(
conn
==
NULL
))
{
vlc_tls_Close
(
session
);
...
...
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