Re: Re: mod_mp3-2 and Apache 2.0.48

Devon Jones <[email protected]> Wed, 28 Jan 2004 18:02:31 -0700
Newsgroups gmane.comp.apache.mod-mp3
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--------------070101090108030706000207
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Brian Aker wrote:

>On Wed, 2004-01-28 at 14:27, Devon Jones wrote:
>  
>
>>ok, whole raft of issues:
>>I don't know apache or apache2, but what I did do is debug some, and get 
>>you a CVS diff of some apache2 ifdefs that I added to the code around 
>>problem pieces of code
>>
>>also, since it's not an apache problem, the line:
>>        if (getID3ByFile(info_ptr, filename))
>>in load.c errors, saying getID3ByFile is an unrecognized symbol - do I 
>>need to add libID3 to my library path for apache?
>>    
>>
>
>No, the interface in load.c needed to be updated (is now).
>
>   -Brian
>
>  
>
ok, with that fixed, I could get to the rest of the errors, I can now 
get mod_mp3 to load without errors - so that means I found and ifdeffed 
all the problems:  If these all get fixed, I suspect it should work.

directives.c:
ap_popenf()
ap_pfopen()

encode.c:
ap_pfopen()

ice.c:
ap_psocket()
ap_pclosesocket()

load.c:
ap_popenf()
ap_pclosef()
ap_pfopen()
ap_pfclose()
ap_make_sub_pool()
apr_make_sub_pool()

log.c:
ap_get_gmtoff()

mod_mp3.c
ap_hard_timeout()
ap_pfclose()
ap_kill_timeout()
ap_pfopen()

-- 
Soulcatcher (Devon Jones)
PCGen BoD
GMGen Silverback


--------------070101090108030706000207
Content-Type: text/plain;
 name="diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="diff"

? .libs
? diff
? mod_mp3.la
Index: directives.c
===================================================================
RCS file: /cvs/mod_mp3/src/directives.c,v
retrieving revision 1.27
diff -u -r1.27 directives.c
--- directives.c	9 Jan 2004 21:07:16 -0000	1.27
+++ directives.c	29 Jan 2004 01:09:25 -0000
@@ -64,11 +64,15 @@
 MP3_EXPORT(const char *) add_log(cmd_parms *cmd, void *mconfig, char *filename) {
 	mp3_conf *cfg = (mp3_conf *) mconfig;
 
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 	if (!(cfg->log = (int)ap_popenf(cmd->pool, filename, (O_WRONLY | O_APPEND | O_CREAT),(S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)))) {
 		mp3_log_error (cmd->server,
 			"Can not open mp3 log file: %s(%s)", filename, strerror(errno));
 		exit(1);
 	}
+#endif
 	cfg->log_filename = ap_pstrdup(cmd->pool, filename);
 
 	return NULL;
@@ -111,11 +115,15 @@
 	cfg->stream = ap_pstrdup(cmd->pool, param);
 	filename = ap_psprintf(cmd->temp_pool, "/tmp/mod_mp3.%s", param);
 
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 	if (!(file = ap_pfopen (cmd->temp_pool, filename, "w"))) {
 		mp3_log_error (cmd->server,
 			"Can not open shard file: %s(%s)", filename, strerror(errno));
 		exit(1);
 	}
+#endif
 	fprintf(file, "%d", cfg->shmid); 
 	ap_register_cleanup(cmd->pool, (char *)file, cleanup_file, ap_null_cleanup);
 
Index: encode.c
===================================================================
RCS file: /cvs/mod_mp3/src/encode.c,v
retrieving revision 1.6
diff -u -r1.6 encode.c
--- encode.c	28 Dec 2003 21:38:39 -0000	1.6
+++ encode.c	29 Jan 2004 01:09:25 -0000
@@ -75,7 +75,11 @@
 #endif
 	if (cfg->encoder == 0) 
 	{
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 		return ap_pfopen(r->pool, content->filename, "r");
+#endif
 	} 
 	#ifdef NOT_DONE
 	else 
Index: ice.c
===================================================================
RCS file: /cvs/mod_mp3/src/ice.c,v
retrieving revision 1.17
diff -u -r1.17 ice.c
--- ice.c	28 Dec 2003 21:38:39 -0000	1.17
+++ ice.c	29 Jan 2004 01:09:25 -0000
@@ -64,17 +64,25 @@
 	hp = (struct hostent *)gethostbyname(r->connection->remote_ip);
 	memcpy(&serv.sin_addr, hp->h_addr, hp->h_length);
 
+#ifdef APACHE2
+//TODO: Apache implementation
+#else
 	if ((socket = ap_psocket (r->pool, AF_INET, SOCK_DGRAM, 0)) < 0) {
 		mp3_log_rerror(r, "Failing socket creation(%s)", strerror(errno));
 		return;
 	}
+#endif
 
 	if (fcntl(socket, F_SETFL, O_NONBLOCK) < 0) {
 		mp3_log_rerror(r, 
 				"Failing blocking for %s(%s)", 
 				r->connection->remote_ip, 
 				strerror(errno));
+#ifdef APACHE2
+//TODO: Apache implementation
+#else
 		ap_pclosesocket(r->pool, socket);
+#endif
 		return;
 	}
 
@@ -82,6 +90,10 @@
 		mp3_log_rerror(r, "Failing sending a message to %s(%s)", r->connection->remote_ip, 
 				strerror(errno));
 	}
+#ifdef APACHE2
+//TODO: Apache implementation
+#else
 	ap_pclosesocket(r->pool, socket);
+#endif
 	return;
 }
Index: load.c
===================================================================
RCS file: /cvs/mod_mp3/src/load.c,v
retrieving revision 1.34
diff -u -r1.34 load.c
--- load.c	29 Jan 2004 00:18:38 -0000	1.34
+++ load.c	29 Jan 2004 01:09:25 -0000
@@ -140,13 +140,21 @@
 		caddr_t temp;
 		/* Yes, this is redundanct at the moment */
 		/* Ok, long run we need to check this */
+#ifdef APACHE2
+//TODO: Apache2 implementation
+#else
 		fd = ap_popenf(p, filename, O_RDONLY, 0);
+#endif
 		lseek(fd, 0, SEEK_SET);
 		temp = mmap(NULL, buf.st_size, PROT_READ, MAP_SHARED, fd, 0);
 		if((temp ==(caddr_t)-1))
 			printf("Woops, blew up\n");  
 		bank->data = temp;
+#ifdef APACHE2
+//TODO: Apache2 implementation
+#else
 		ap_pclosef(p, fd);
+#endif
 	}
 
 	return bank;
@@ -157,10 +165,14 @@
 	char buf[HUGE_STRING_LEN];
 	int length = 0;
 
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 	if (!(file_ptr = ap_pfopen (p, file, "r"))) {
 		/* Question this Brian */
 		return HTTP_NOT_FOUND;
 	}
+#endif
 	while (fgets (buf, sizeof (buf), file_ptr)) {
 		length = strlen(buf);
 		buf[length-1] = '\0';
@@ -168,7 +180,11 @@
 			/* Need to add an error message here */
 		} 
 	}
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 	ap_pfclose (p, file_ptr);
+#endif
 
 	return OK;
 }
@@ -238,7 +254,8 @@
 	if (!temp_pool) 
 	{
 #ifdef APACHE2
-		temp_pool = apr_make_sub_pool(&temp_pool, p);
+//TODO: fix this, apr_make_sub_pool doesn't seem to work
+		//temp_pool = apr_make_sub_pool(&temp_pool, p);
 #else
 		temp_pool = ap_make_sub_pool(p);
 #endif
Index: log.c
===================================================================
RCS file: /cvs/mod_mp3/src/log.c,v
retrieving revision 1.4
diff -u -r1.4 log.c
--- log.c	20 May 2002 00:45:56 -0000	1.4
+++ log.c	29 Jan 2004 01:09:25 -0000
@@ -7,7 +7,12 @@
 
 MP3_EXPORT(void) write_log(request_rec *r, mp3_conf *cfg, request_data *info, mp3_data *bank) {
 	int timz;
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+	struct tm *t;
+#else
 	struct tm *t = ap_get_gmtoff(&timz);
+#endif
 	char sign = (timz < 0 ? '-' : '+');
 	unsigned char buffer[HUGE_STRING_LEN];
 	int size = 0;
Index: mod_mp3.c
===================================================================
RCS file: /cvs/mod_mp3/src/mod_mp3.c,v
retrieving revision 1.120
diff -u -r1.120 mod_mp3.c
--- mod_mp3.c	28 Dec 2003 21:38:39 -0000	1.120
+++ mod_mp3.c	29 Jan 2004 01:09:26 -0000
@@ -153,7 +153,11 @@
 		send_udp_message(r, request->udp, message);
 	}
 
+#ifdef APACHE2
+//TODO: Apache2 implementation 
+#else
 	ap_hard_timeout("mod_mp3_write", r);
+#endif
 
 	connection_set_file(r, scfg, content->signature, content->name);
 
@@ -197,10 +201,17 @@
 				send_udp_message(r, request->udp, message);
 			}
 		}
+#ifdef APACHE2
+//TODO: Apache2 implementation
+#else
 		ap_pfclose(r->pool, file);
+#endif
 	}
+#ifdef APACHE2
+//TODO: Apache2 implementation
+#else
 	ap_kill_timeout(r);
-
+#endif
 	return OK;
 }
 
@@ -907,10 +918,14 @@
 	if ((status = register_connection(r, scfg, cfg->connection_limit, 1)) != OK) {
 		return status;
 	}
+#ifdef APACHE2
+//TODO: Apache 2 implementation
+#else
 	if (!(file = ap_pfopen(r->pool, local_stream, "r"))) { 
 		mp3_log_rerror(r, "Could not open file: %s(%s)", local_stream, strerror(errno));
 		return HTTP_NOT_FOUND;
 	}
+#endif
 
 	while ((b = fgetc(file))){
 	while ((b = fgetc(file)) != EOF && (cfg->max_bytes <= 0 || x <= cfg->max_bytes) ) {
Index: proto.h
===================================================================
RCS file: /cvs/mod_mp3/src/proto.h,v
retrieving revision 1.50
diff -u -r1.50 proto.h
--- proto.h	28 Jan 2004 21:45:21 -0000	1.50
+++ proto.h	29 Jan 2004 01:09:26 -0000
@@ -45,4 +45,14 @@
 int mp3_get_child (request_rec *r);
 void mp3_log_rerror(request_rec *r, const char *fmt, ...);
 void mp3_log_error(server_rec *server, const char *fmt, ...);
-const char * add_directory_server(cmd_parms *cmd, void *mconfig, char *server, int strict);
+void * mysql_create(pool *p);
+void mysql_cleanup(void *data);
+int mysql_request(void *info, void *cfg, pool *p);
+mp3_data * mysql_get(void *info, pool *p, char *signature);
+int mysql_set(void *info, pool *p, mp3_data *bank);
+mp3_data * mysql_each(void *info, pool *p, array_header *files, const char *token, int random);
+int mysql_count(void *info, pool *p, array_header *files, const char *token);
+array_header * mysql_search(void *info, pool *p, const char *pattern, int limit);
+const char * mysql_add_connect_info(cmd_parms *cmd, void *mconfig, char *hostname, char *user, char *password);
+const char * mysql_add_database_info(cmd_parms *cmd, void *mconfig, char *database, char *table);
+const char * mysql_add_token_table(cmd_parms *cmd, void *mconfig, char *table);

--------------070101090108030706000207--