Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Icecast-Server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
93
Issues
93
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
External Wiki
External Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xiph.Org
Icecast-Server
Commits
c7e04b28
Commit
c7e04b28
authored
Aug 08, 2005
by
Karl Heyes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow for webroot requests to be sent via an authenticator
svn path=/icecast/trunk/icecast/; revision=9717
parent
eebb340a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
18 deletions
+24
-18
src/auth.c
src/auth.c
+6
-0
src/connection.c
src/connection.c
+0
-6
src/fserve.c
src/fserve.c
+18
-12
No files found.
src/auth.c
View file @
c7e04b28
...
...
@@ -31,6 +31,7 @@
#include "cfgfile.h"
#include "stats.h"
#include "httpp/httpp.h"
#include "fserve.h"
#include "logging.h"
#define CATMODULE "auth"
...
...
@@ -317,6 +318,11 @@ static int add_authenticated_client (const char *mount, mount_proxy *mountinfo,
if
(
ret
==
0
)
DEBUG0
(
"client authenticated, passed to source"
);
}
else
{
avl_tree_unlock
(
global
.
source_tree
);
fserve_client_create
(
client
,
mount
);
}
return
ret
;
}
...
...
src/connection.c
View file @
c7e04b28
...
...
@@ -823,12 +823,6 @@ static void _handle_get_request (client_t *client, char *passed_uri)
return
;
}
if
(
fserve_client_create
(
client
,
uri
))
{
if
(
uri
!=
passed_uri
)
free
(
uri
);
return
;
}
sock_set_blocking
(
client
->
con
->
sock
,
SOCK_NONBLOCK
);
sock_set_nodelay
(
client
->
con
->
sock
);
...
...
src/fserve.c
View file @
c7e04b28
...
...
@@ -19,6 +19,7 @@
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#ifdef HAVE_POLL
#include <sys/poll.h>
...
...
@@ -65,7 +66,7 @@
#endif
static
fserve_t
*
active_list
=
NULL
;
volatile
static
fserve_t
*
pending_list
=
NULL
;
static
volatile
fserve_t
*
pending_list
=
NULL
;
static
mutex_t
pending_lock
;
static
avl_tree
*
mimetypes
=
NULL
;
...
...
@@ -232,7 +233,7 @@ static void wait_for_fds() {
static
void
*
fserv_thread_function
(
void
*
arg
)
{
fserve_t
*
fclient
,
**
trail
;
int
sbytes
,
bytes
;
int
bytes
;
INFO0
(
"file serving thread started"
);
while
(
run_fserv
)
{
...
...
@@ -271,7 +272,7 @@ static void *fserv_thread_function(void *arg)
}
/* Now try and send current chunk. */
sbytes
=
format_generic_write_to_client
(
client
);
format_generic_write_to_client
(
client
);
if
(
client
->
con
->
error
)
{
...
...
@@ -358,7 +359,10 @@ static void fserve_client_destroy(fserve_t *fclient)
}
int
fserve_client_create
(
client_t
*
httpclient
,
const
char
*
path
)
/* client has requested a file, so check for it and send the file. Do not
* refer to the client_t afterwards. return 0 for success, -1 on error.
*/
int
fserve_client_create
(
client_t
*
httpclient
,
const
char
*
path
)
{
int
bytes
;
struct
stat
file_buf
;
...
...
@@ -384,8 +388,10 @@ int fserve_client_create(client_t *httpclient, const char *path)
/* the m3u can be generated, but send an m3u file if available */
if
(
m3u_requested
==
0
)
{
WARN2
(
"req for file
\"
%s
\"
%s"
,
fullpath
,
strerror
(
errno
));
client_send_404
(
httpclient
,
"The file you requested could not be found"
);
free
(
fullpath
);
return
0
;
return
-
1
;
}
m3u_file_available
=
0
;
}
...
...
@@ -426,7 +432,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
fserve_add_client
(
httpclient
,
NULL
);
free
(
sourceuri
);
free
(
fullpath
);
return
1
;
return
0
;
}
/* on demand file serving check */
...
...
@@ -437,7 +443,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
client_send_404
(
httpclient
,
"The file you requested could not be found"
);
config_release_config
();
free
(
fullpath
);
return
0
;
return
-
1
;
}
config_release_config
();
...
...
@@ -446,7 +452,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
client_send_404
(
httpclient
,
"The file you requested could not be found"
);
WARN1
(
"found requested file but there is no handler for it: %s"
,
fullpath
);
free
(
fullpath
);
return
1
;
return
-
1
;
}
file
=
fopen
(
fullpath
,
"rb"
);
...
...
@@ -455,7 +461,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
{
WARN1
(
"Problem accessing file
\"
%s
\"
"
,
fullpath
);
client_send_404
(
httpclient
,
"File not readable"
);
return
1
;
return
-
1
;
}
content_length
=
(
int64_t
)
file_buf
.
st_size
;
...
...
@@ -515,7 +521,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
sock_write
(
httpclient
->
con
->
sock
,
"HTTP/1.0 416 Request Range Not Satisfiable
\r\n\r\n
"
);
client_destroy
(
httpclient
);
return
1
;
return
-
1
;
}
}
else
{
...
...
@@ -525,7 +531,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
sock_write
(
httpclient
->
con
->
sock
,
"HTTP/1.0 416 Request Range Not Satisfiable
\r\n\r\n
"
);
client_destroy
(
httpclient
);
return
1
;
return
-
1
;
}
}
else
{
...
...
@@ -544,7 +550,7 @@ int fserve_client_create(client_t *httpclient, const char *path)
stats_event_inc
(
NULL
,
"file_connections"
);
fserve_add_client
(
httpclient
,
file
);
return
1
;
return
0
;
}
...
...
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