Generating a PublicHubList.config from PHP

Technical discussion about the NMDC and <a href="http://dcpp.net/ADC.html">ADC</A> protocol. The NMDC protocol is documented in the <a href="http://dcpp.net/wiki/">Wiki</a>, so feel free to refer to it.

Moderator: Moderators

Locked
djechelon
Posts: 8
Joined: 2004-10-29 11:44

Generating a PublicHubList.config from PHP

Post by djechelon » 2004-10-29 11:57

Hello there.
I'm having problems with a new PHP Nuke Module made by me about Direct Connect Public Hublists.

I have made all the list database with all the hubs inside with no problem.

Now I have to generate the PublicHubList.config file (I'll compress it later with bz2).

I use the following code to generate the list:

Code: Select all

while ($hubrow = mysql_fetch_array($hubqry)) {
        $listarray[$i] = $hubrow["nome"]."|".$hubrow["indirizzo"]."|".$hubrow["descrizione"]."|".$hubrow["utenti"];
        $i++;
}
unset($hubrow);
$page = join("|||||",$listarray);
echo $page;
As I open it from my browser it is shown correctly.
As I save its content in a file named PublicHubList.config or else my DC++ client successfully opens it, BUT....
When I call the PHP script directly from the URL, with Apache's Rewrite Mod, Internet Explorer opens it, but DC++ doesn't. The error message is "Error: Disconnected (http://www.p2pmania.it/PublicHubList.config)".

I'm using the Rewrite Mod because I thaught that DC++ couldn't recognize .php files, but I was wrong.

Now I ask you: have I to send some special headers to the client when downloading the list? I mean, do I have to put

Code: Select all

header("Content-type: text/plain");
before echo? Or some different content type?? Why doesn' DC++ open the dynamic list (generated each time from database), but it opens the static list (a file created by the same PHP script)?

I was actually thinking about creating a special directory containing only the Public Lists, generated by the server at certain hours. It would be a HUGE directory, containing all the possible hublists (bz2 compressed and not compressed, for old clients, country's hublist, etc.). I have no disk space problems, but I think it would be smarter to auto-generate the list at each connection, even if it is a little performance-slowing.
DJ ECHELON

MASTER OF BIT TORRENT

WEBMASTER http://www.p2pmania.it
My FAST PublicHubList http://www.p2pmania.it/hublists/PublicH ... config.bz2

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-10-29 12:50

Instead of creating a .config file using the old NMDC style, why not create a new .xml.bz2 hublist? You can download one from either of the following places to see the style:

http://www.hublist.org/PublicHubList.xml.bz2
http://wza.digitalbrains.com/DC/hublist.xml.bz2

I'm on the prowl for more hublists to ship in DC++ by default, and .xml ones come first. ;)

PS - If you give your url for testing, you're much more likely to have one test it under a debugger.

djechelon
Posts: 8
Joined: 2004-10-29 11:44

Post by djechelon » 2004-10-29 15:13

I want to generate config list for compatibility reasons.
I'm planning to work on XML lists, but I haven't yet made to parse them.

The test URL is http://www.p2pmania.it/hublist.php. It works on the browser but not on DC++
During these hours I created a cache of lists, available at http://www.p2pmania.it/hublists/PublicH ... config.bz2
where [COD] is a 2 letters code for the chosen country, like IP2Country standards
DJ ECHELON

MASTER OF BIT TORRENT

WEBMASTER http://www.p2pmania.it
My FAST PublicHubList http://www.p2pmania.it/hublists/PublicH ... config.bz2

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-10-29 22:25

Thanks for the other urls, I'll take a look and report back later.

GargoyleMT
DC++ Contributor
Posts: 3212
Joined: 2003-01-07 21:46
Location: .pa.us

Post by GargoyleMT » 2004-10-30 09:13

Sent:

Code: Select all

GET /PublicHubList.config HTTP/1.1
User-Agent: DC++ v0.4034
Host: www.p2pmania.it
Connection: close
Cache-Control: no-cache
Received (these are only the headers):

Code: Select all

HTTP/1.1 200 OK
Date: Sat, 30 Oct 2004 14:09:40 GMT
Server: Apache/2.0.49 (Unix) mod_watch/4.3
X-Powered-By: PHP/4.3.5
Connection: close
Transfer-Encoding: chunked
Content-Type: text/plain
As far as I know, DC++ doesn't have any code to support Transfer-Encoding: chunked.

djechelon
Posts: 8
Joined: 2004-10-29 11:44

Post by djechelon » 2004-11-20 07:34

What can I do on server-side script to change the transfer encoding? Set a new header? Which header?
DJ ECHELON

MASTER OF BIT TORRENT

WEBMASTER http://www.p2pmania.it
My FAST PublicHubList http://www.p2pmania.it/hublists/PublicH ... config.bz2

Locked