GLBasic forum

Main forum => Bug Reports => Topic started by: Moru on 2011-Nov-20

Title: NETWEBGET$ and the length of URLs
Post by: Moru on 2011-Nov-20
I'm having troubles using long URLĀ“s. When I get close to 1024 I sometimes get  "*** Unhandled exception ***" in the debug window.

This code always leads to this at output-line 950:

Code (glbasic) Select
// --------------------------------- //
// Project: netwebget_url_length
// Start: Sunday, November 20, 2011
// IDE Version: 10.159


// SETCURRENTDIR("Media") // go to media files

LOCAL start = 910
LOCAL url$ = "/highscores/index.php/data/put/"
LOCAL ok$

FOR n = 0 TO start
url$ = url$+"A"
NEXT

FOR n = start TO 1024
url$ = url$ + "a"
DEBUG LEN(url$)
ok$ = NETWEBGET$("gamecorner.110mb.com", url$, 80, 5000)
DEBUG " Result: " + ok$ + "\n"
SHOWSCREEN
NEXT



My computer runs Windows XP 32 bit.
Title: Re: NETWEBGET$ and the length of URLs
Post by: MrTAToad on 2011-Nov-20
I get :

Quote
943 Result: Error: Bad boy-request. Be Gone you foul creature!
944 Result: Error: Bad boy-request. Be Gone you foul creature!
945 Result: Error: Bad boy-request. Be Gone you foul creature!
946 Result: Error: Bad boy-request. Be Gone you foul creature!
947 Result: Error: Bad boy-request. Be Gone you foul creature!
948 Result: Error: Bad boy-request. Be Gone you foul creature!
949*** Unhandled exception ***
   EXCEPTION_INVALID_HANDLE
Title: Re: NETWEBGET$ and the length of URLs
Post by: Moru on 2011-Nov-20
The text after Result: shows it's working up until the line with 949 characters in the URI. Then it breaks in an ugly way. I'm not expecting to be able to send 4096 bytes in an URI but I do expect it not to crash in case I do send 4096 bytes :-)

This is especially important since it seems to crash at different length on different computers.

Ps: My base64 library is updated on my homepage. Fixes this crash and adds a function to decode base64 to binary array. See link in sig.
Title: Re: NETWEBGET$ and the length of URLs
Post by: MrTAToad on 2011-Nov-20
I suspect that NETWEBGET is opening a socket but either not closing it or getting a new one and not checking to see if its valid  :)
Title: Re: NETWEBGET$ and the length of URLs
Post by: Kitty Hello on 2011-Nov-21
there's a buffer of 1024 bytes for sending the HTTP-Get request.
Do you really need that long urls?
Title: Re: NETWEBGET$ and the length of URLs
Post by: Moru on 2011-Nov-21
As I stated above, the problem is not if I need it or not. I would just like it to fail gracefully if the length is too long instead of crashing without any error message that can be traced to the command. The command could return false for failure as it does if it times out or the host can't be resolved.

Btw, I had earlier set the length to 768 and that worked, now it doesn't work any more.

Oh, and yes there is moments when an URL of 4096 bytes might be needed. I'm in such a case at work right now but here GLBasic isn't involved.
Title: Re: NETWEBGET$ and the length of URLs
Post by: Kitty Hello on 2011-Nov-21
fixed in current update.
Title: Re: NETWEBGET$ and the length of URLs
Post by: Moru on 2011-Nov-21
Great, thanks!