Gnutella Forums

Gnutella Forums (https://www.gnutellaforums.com/)
-   General Gnutella Development Discussion (https://www.gnutellaforums.com/general-gnutella-development-discussion/)
-   -   bad request (https://www.gnutellaforums.com/general-gnutella-development-discussion/93586-bad-request.html)

thp September 15th, 2009 06:55 AM

bad request
 
Hello, I'm still getting Bad Request of my Get querry and I have no idear
what's wrong. My Get querry looks like this:

GET /get/584/Sex%20Pistols%20-%20Pretty%20Vacant.mp3 HTTP/1.1
User-Agent: Gnutella/0.6
Host:12.34.5.67:7474
Connection: Keep-Alive
Range: bytes=0-

Most of the time it works fine, but somtimes I get 400 Bad Request, so there
is mayby somthing wrong.
And how are the exactly rules for URLEncoding i'm still not sure what to make with
space '+' or '%20' ?

Thank You

thp

arne_bab September 15th, 2009 10:45 PM

Do the failures still occur when you escape spaces with "+"?

Which programming language do you use?

thp September 16th, 2009 02:08 AM

Hello,

The failures still occurs when i escape spaces with "+" or with "%20" it seems
it makes no differences. I use java as programming language. at first i tried
the java URLEncoder(String, String), but i'm not sure if this is the right thing so i made my own but i don't know the exact rules for Gnutella encoding is there a list somwhere? The java encoder escapes spaces with "+".

Thank you very much

thp

arne_bab September 16th, 2009 07:54 AM

The Gnutella specification is at GDF - LimeWire

Downloading is described at File Transfer - LimeWire

(but it might be outdated, see below)

which points to RFC 2616 (HTTP 1.1) http://www.ietf.org/rfc/rfc2616.txt

But since changing the escaping doesn't change the result, it doesn't look like that's the reason.

Maybe a look into the Phex source can help you:
https://phex.svn.sourceforge.net/svn...eDownload.java

...

damn, I see it: You don't request by sha1 URN.

IIRC, the URI in the get request should be like

Code:

/uri-res/N2R?urn:sha1:GIVPHMUG6LZQPTKJ6ELMQDXBN7BZS354
Best wishes,
Arne

thp September 16th, 2009 11:06 AM

Hello arne_bab,

This seems right, but i don't know how to ad or replace this in my get request can you please show me a complet example. I made a few experiments but did not find the solution.

Thank you very much

thp

arne_bab September 16th, 2009 01:04 PM

GET /uri-res/N2R?urn:sha1:GIVPHMUG6LZQPTKJ6ELMQDXBN7BZS354 HTTP/1.1
User-Agent: Your Client!
Host:12.34.5.67:7474
Connection: Keep-Alive
Range: bytes=0-

For this you have to have the sha1 hash of the file in Base32, UPPERCASE, but it comes in every query reply, so you should already have received it before you request anything.

thp September 16th, 2009 10:59 PM

Hi,

This works fine now, the `HTTP/1.1 part` was my mistake :super: . And i don't need URLEncoding anymore! Is the old `Get /get/...` line now completly
replaced?

Thank you very much :laugh_2:

thp

arne_bab September 16th, 2009 11:37 PM

I'm glad to hear that!

Since Phex still has code to handle the /get/ style requests (as it seems others have, too), I think it wasn't completely replaced, but it is completely obsolete, as requesting by sha1 is the only way to be sure that you get the right file. Since you likely will want to implement the DownloadMesh and Partial Filesharing, you'll need to use that anyway :)

What you definitely need is a correct Vendor String. Without that you'll get disconnected quickly.

Good luck with your client!
(btw: can I find it somewhere? and is it free software?)

clocksun September 20th, 2009 06:52 AM

what programming launguage do u use

thp September 20th, 2009 07:38 AM

if you mean me,
I use java as a programming language.

thp

arne_bab September 20th, 2009 07:53 AM

@thp: Besides: Since Phex is GPL licensed, you can borrow code from it (if you also license your program under the GPL). That might save you a person-years of coding or so.

thp September 20th, 2009 10:28 AM

Hello Arne,

I learned a lot of thinks so far from the phex. But i could't find the part
where the Get request is put together. It's obviously not in the phex
package. Do you now where it is?
Do you know why the phex is disconnectig all peers and ultrapeers in idle after a few days?

thp

arne_bab September 20th, 2009 12:51 PM

Hi thp,

Quote:

Originally Posted by thp (Post 349057)
I learned a lot of thinks so far from the phex. But i could't find the part
where the Get request is put together. It's obviously not in the phex
package. Do you now where it is?

Not exactly, no.

I assume it's a standard Java facility.

But you can always just ask in the Phex forum: Development & Coding - Gnutella Forums

Quote:

Do you know why the phex is disconnectig all peers and ultrapeers in idle after a few days?
I didn't even know that it does... which version?

thp September 21st, 2009 02:22 AM

Hi Arne,

I use the version 3.0.2.100.1. Higher versions are unstable with a lot of
peers and more search querrys, at the same time. There are some time
mixed search results.

thp

arne_bab September 21st, 2009 02:38 AM

You could try if 3.4.2 gives better results.

How many peers do you have?

thp September 21st, 2009 03:37 AM

Quote:

Originally Posted by arne_bab (Post 349081)
You could try if 3.4.2 gives better results.

How many peers do you have?

Hi,
Never tried this version, mayby i give it a try soon.
The last one i tried was 3.2.6. I set it to about 120 peers.

thp

arne_bab September 21st, 2009 04:00 AM

Do you mean 120 peers: 80 Ultrapeers + 40 Leafs?

Otherwise it shouldn't be possible to set more that 99 Ultrapeers...

My own tests show that Phex easily handles 66 ultrapeers, but 99 were too much for my internet-connection when I last tested it (phex ran without problems, though).

Best wishes,
Arne


All times are GMT -7. The time now is 09:45 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 ©2011, Crawlability, Inc.

Copyright © 2020 Gnutella Forums.
All Rights Reserved.