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


All times are GMT -7. The time now is 12:35 PM.

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.