[Mt-daapd-cvs] mt-daapd/src configfile.c,1.69,1.70
Status: Beta
Brought to you by:
andrew40
From: Ron P. <rp...@us...> - 2005-06-15 03:27:40
|
Update of /cvsroot/mt-daapd/mt-daapd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11981 Modified Files: configfile.c Log Message: add 'host' smart tag to support daap applet Index: configfile.c =================================================================== RCS file: /cvsroot/mt-daapd/mt-daapd/src/configfile.c,v retrieving revision 1.69 retrieving revision 1.70 diff -C2 -d -r1.69 -r1.70 *** configfile.c 15 Jun 2005 02:44:32 -0000 1.69 --- configfile.c 15 Jun 2005 03:27:27 -0000 1.70 *************** *** 74,77 **** --- 74,78 ---- static void config_emit_system(WS_CONNINFO *pwsc, void *value, char *arg); static void config_emit_flags(WS_CONNINFO *pwsc, void *value, char *arg); + static void config_emit_host(WS_CONNINFO *pwsc, void *value, char *arg); static void config_subst_stream(WS_CONNINFO *pwsc, int fd_src); static int config_file_is_readonly(void); *************** *** 137,140 **** --- 138,142 ---- { 1,0,0,CONFIG_TYPE_STRING,"password",(void*)&config.readpassword, config_emit_string }, { 1,0,0,CONFIG_TYPE_STRING,"logfile",(void*)&config.logfile, config_emit_string }, + { 0,0,0,CONFIG_TYPE_SPECIAL,"host",(void*)NULL,config_emit_host }, { 0,0,0,CONFIG_TYPE_SPECIAL,"release",(void*)VERSION,config_emit_literal }, { 0,0,0,CONFIG_TYPE_SPECIAL,"package",(void*)PACKAGE,config_emit_literal }, *************** *** 740,743 **** --- 742,772 ---- /** + * emit the host value passed by the client web server. This + * is really used to autoconfig the java client + * + * \param pwsc web connection + * \param value the variable that was requested + * \param arg any args passwd with the meta command + */ + void config_emit_host(WS_CONNINFO *pwsc, void *value, char *arg) { + char *host; + char *port; + + if(ws_getrequestheader(pwsc,"host")) { + host = strdup(ws_getrequestheader(pwsc,"host")); + if((port = strrchr(host,':'))) { + *port = '\0'; + } + ws_writefd(pwsc,"%s",host); + free(host); + } else { + DPRINTF(E_LOG,L_CONF,"Didn't get a host header!\n"); + ws_writefd(pwsc,"localhost"); + } + + return; + } + + /** * Used to emit a string configuration value to an admin page * |