Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
ESP32-audioI2S
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
ESP32-audioI2S
Commits
ab959027
Unverified
Commit
ab959027
authored
Nov 25, 2022
by
Wolle
Committed by
GitHub
Nov 25, 2022
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #417 from mathertel/patch-1
avoid empty http authorization header
parents
c8497aa3
bccb3a7d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
12 deletions
+17
-12
src/Audio.cpp
src/Audio.cpp
+17
-12
No files found.
src/Audio.cpp
View file @
ab959027
...
...
@@ -432,16 +432,17 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
if
(
startsWith
(
l_host
,
"https"
))
m_f_ssl
=
true
;
else
m_f_ssl
=
false
;
// authentification
uint8_t
auth
=
strlen
(
user
)
+
strlen
(
pwd
);
char
toEncode
[
auth
+
4
];
toEncode
[
0
]
=
'\0'
;
strcat
(
toEncode
,
user
);
strcat
(
toEncode
,
":"
);
strcat
(
toEncode
,
pwd
);
char
authorization
[
base64_encode_expected_len
(
strlen
(
toEncode
))
+
1
];
// optional basic authorization
uint16_t
auth
=
strlen
(
user
)
+
strlen
(
pwd
);
char
authorization
[
base64_encode_expected_len
(
auth
+
1
)
+
1
];
authorization
[
0
]
=
'\0'
;
b64encode
((
const
char
*
)
toEncode
,
strlen
(
toEncode
),
authorization
);
if
(
auth
>
0
)
{
char
toEncode
[
auth
+
4
];
strcpy
(
toEncode
,
user
);
strcat
(
toEncode
,
":"
);
strcat
(
toEncode
,
pwd
);
b64encode
((
const
char
*
)
toEncode
,
strlen
(
toEncode
),
authorization
);
}
// AUDIO_INFO("Connect to \"%s\" on port %d, extension \"%s\"", hostwoext, port, extension);
...
...
@@ -455,9 +456,13 @@ bool Audio::connecttohost(const char* host, const char* user, const char* pwd) {
strcat
(
rqh
,
hostwoext
);
strcat
(
rqh
,
"
\r\n
"
);
strcat
(
rqh
,
"Icy-MetaData:1
\r\n
"
);
strcat
(
rqh
,
"Authorization: Basic "
);
strcat
(
rqh
,
authorization
);
strcat
(
rqh
,
"
\r\n
"
);
if
(
auth
>
0
)
{
strcat
(
rqh
,
"Authorization: Basic "
);
strcat
(
rqh
,
authorization
);
strcat
(
rqh
,
"
\r\n
"
);
}
strcat
(
rqh
,
"Accept-Encoding: identity;q=1,*;q=0
\r\n
"
);
// strcat(rqh, "User-Agent: Mozilla/5.0\r\n"); #363
strcat
(
rqh
,
"Connection: keep-alive
\r\n\r\n
"
);
...
...
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