/* Msg functions facilities */
VLC_EXPORT( void, httpd_MsgInit, ( httpd_message_t * ) );
-VLC_EXPORT( void, httpd_MsgAdd, ( httpd_message_t *, char *psz_name, char *psz_value, ... ) );
+VLC_EXPORT( void, httpd_MsgAdd, ( httpd_message_t *, const char *psz_name, const char *psz_value, ... ) );
/* return "" if not found. The string is not allocated */
-VLC_EXPORT( char *, httpd_MsgGet, ( httpd_message_t *, char *psz_name ) );
+VLC_EXPORT( const char *, httpd_MsgGet, ( httpd_message_t *, const char *psz_name ) );
VLC_EXPORT( void, httpd_MsgClean, ( httpd_message_t * ) );
#endif /* _VLC_HTTPD_H */
int (*httpd_StreamHeader_inner) (httpd_stream_t *, uint8_t *p_data, int i_data);
int (*httpd_StreamSend_inner) (httpd_stream_t *, uint8_t *p_data, int i_data);
void (*httpd_MsgInit_inner) (httpd_message_t *);
- void (*httpd_MsgAdd_inner) (httpd_message_t *, char *psz_name, char *psz_value, ...);
- char * (*httpd_MsgGet_inner) (httpd_message_t *, char *psz_name);
+ void (*httpd_MsgAdd_inner) (httpd_message_t *, const char *psz_name, const char *psz_value, ...);
+ const char * (*httpd_MsgGet_inner) (httpd_message_t *, const char *psz_name);
void (*httpd_MsgClean_inner) (httpd_message_t *);
tls_server_t * (*tls_ServerCreate_inner) (vlc_object_t *, const char *, const char *);
void (*tls_ServerDelete_inner) (tls_server_t *);
* Various functions
*****************************************************************************/
/*char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";*/
-static void b64_decode( char *dest, char *src )
+static void b64_decode( char *restrict dest, const char *restrict src )
{
int i_level;
int last = 0;
httpd_file_t *file = (httpd_file_t*)p_sys;
uint8_t *psz_args = query->psz_args;
uint8_t **pp_body, *p_body;
- char *psz_connection = NULL;
+ const char *psz_connection;
int *pi_body, i_body;
if( answer == NULL || query == NULL )
if( strncmp( (char *)answer->p_body, "HTTP/1.", 7 ) )
{
int i_status, i_headers;
- char *psz_headers, *psz_new, *psz_status;
+ char *psz_headers, *psz_new;
+ const char *psz_status;
if( !strncmp( (char *)answer->p_body, "Status: ", 8 ) )
{
httpd_MsgInit( msg );
}
-char *httpd_MsgGet( httpd_message_t *msg, char *name )
+const char *httpd_MsgGet( httpd_message_t *msg, const char *name )
{
int i;
return NULL;
}
-void httpd_MsgAdd( httpd_message_t *msg, char *name, char *psz_value, ... )
+void httpd_MsgAdd( httpd_message_t *msg, const char *name, const char *psz_value, ... )
{
va_list args;
char *value = NULL;
{
static const struct
{
- char *name;
+ const char *name;
int i_type;
int i_proto;
}
}
else if( i_msg == HTTPD_MSG_OPTIONS )
{
- char *psz_cseq = NULL;
+ const char *psz_cseq;
int i_cseq;
/* unimplemented */
if( answer && ( *url->psz_user || *url->psz_password ) )
{
/* create the headers */
- char *b64 = httpd_MsgGet( query, "Authorization" ); /* BASIC id */
+ const char *b64 = httpd_MsgGet( query, "Authorization" ); /* BASIC id */
char *auth;
char *id;
asprintf( &id, "%s:%s", url->psz_user, url->psz_password );
- if( b64 ) auth = malloc( strlen(b64) + 1 );
- else auth = malloc( strlen("") + 1 );
-
if( b64 != NULL
&& !strncasecmp( b64, "BASIC", 5 ) )
{
{
b64++;
}
+ auth = malloc( strlen(b64) + 1 );
b64_decode( auth, b64 );
}
else
{
- strcpy( auth, "" );
+ auth = strdup( "" );
}
if( strcmp( id, auth ) )
{
if( cl->i_mode == HTTPD_CLIENT_FILE || cl->answer.i_body_offset == 0 )
{
- char *psz_connection = httpd_MsgGet( &cl->answer, "Connection" );
- char *psz_query = httpd_MsgGet( &cl->query, "Connection" );
+ const char *psz_connection = httpd_MsgGet( &cl->answer, "Connection" );
+ const char *psz_query = httpd_MsgGet( &cl->query, "Connection" );
vlc_bool_t b_connection = VLC_FALSE;
vlc_bool_t b_keepalive = VLC_FALSE;
vlc_bool_t b_query = VLC_FALSE;
{
}
-void httpd_MsgAdd ( httpd_message_t *a, char *b, char *c, ... )
+void httpd_MsgAdd ( httpd_message_t *a, const char *b, const char *c, ... )
{
}
-char *httpd_MsgGet ( httpd_message_t *a, char *b )
+const char *httpd_MsgGet ( httpd_message_t *a, const char *b )
{
- return NULL;
+ return "";
}
void httpd_MsgClean( httpd_message_t *a )