Home All Groups Group Topic Archive Search About

HttpWebRequest inconsistency 8-[

Author
30 Oct 2007 3:14 PM
Pascal Soveaux
Hi,

WebResponse contentlength returns an Int64 BUT HttpWebRequest.AddRange
takes an Int32.

Please point me to the specification that requires a range to be pass as
an Int32, AFAIK 1 or more digit is not a synonym for Int32.

Here is the detail of the communication.

I : "Server, tell me how big is that file please" (you have to be polite
when you are talking to a Server)
Server : "Well boy that's a pretty huge file : 6 gb. But you know I am
smart, that's why I am the server and you are the client, you just have
to ask for a part of that file. Tell me which part you want to retrieve,
where to start and optionally where to stop, and I will send that part
to you"
I : "Look I already downloaded the first 5 gb, so let's me see...say
hmmm... 6 - 5... where is the shortcut for the calc? hummm... I think
that I just need the last giga"
- I : webRequest.Headers.Add("range", 5 Gb)
- WebRequest = "Oh, noooo! you cannot do that, use AddRange and I will
take care of that for you."
- I : "Ok let's do that..."
- I : webRequest.AddRange(from)
- Compiler : "Oh dork! WTF are you trying to do with this Int64, huh?
RTFM, I'll keep an eye on you pal..."
- I : "But what?! WebRequest? Don't you accept an Int64 as a valid range
value ? "
- WebRequest = "Actually...I am afraid not. You will have to download
this huge file at once...Hey! But wait till .NET 4.5, you will have some
powerful functions like P2P, enforced design patterns, DTC and a lot
more..."
- I : "Ok, sounds great! But...for now, I just want to be able to use
something for which the specifications exist for years! Do I have to
reinvent the wheel?"
- WebRequest : "Well, I am afraid yes. But you should ask the community
first. I am pretty sure that you are not the first person to face this
problem. I remember my grandfather, wininet, has more or less the same
problem. That's genetic...or by design as we use to say here!"
- I : "...the same old new thing..."

Any idea?

Pascal

Author
2 Nov 2007 9:21 AM
Pascal Soveaux
Pascal Soveaux wrote:
Show quote
> Hi,
>
> WebResponse contentlength returns an Int64 BUT HttpWebRequest.AddRange
> takes an Int32.
>
> Please point me to the specification that requires a range to be pass as
> an Int32, AFAIK 1 or more digit is not a synonym for Int32.
>
> Here is the detail of the communication.
>
> I : "Server, tell me how big is that file please" (you have to be polite
> when you are talking to a Server)
> Server : "Well boy that's a pretty huge file : 6 gb. But you know I am
> smart, that's why I am the server and you are the client, you just have
> to ask for a part of that file. Tell me which part you want to retrieve,
> where to start and optionally where to stop, and I will send that part
> to you"
> I : "Look I already downloaded the first 5 gb, so let's me see...say
> hmmm... 6 - 5... where is the shortcut for the calc? hummm... I think
> that I just need the last giga"
> - I : webRequest.Headers.Add("range", 5 Gb)
> - WebRequest = "Oh, noooo! you cannot do that, use AddRange and I will
> take care of that for you."
> - I : "Ok let's do that..."
> - I : webRequest.AddRange(from)
> - Compiler : "Oh dork! WTF are you trying to do with this Int64, huh?
> RTFM, I'll keep an eye on you pal..."
> - I : "But what?! WebRequest? Don't you accept an Int64 as a valid range
> value ? "
> - WebRequest = "Actually...I am afraid not. You will have to download
> this huge file at once...Hey! But wait till .NET 4.5, you will have some
> powerful functions like P2P, enforced design patterns, DTC and a lot
> more..."
> - I : "Ok, sounds great! But...for now, I just want to be able to use
> something for which the specifications exist for years! Do I have to
> reinvent the wheel?"
> - WebRequest : "Well, I am afraid yes. But you should ask the community
> first. I am pretty sure that you are not the first person to face this
> problem. I remember my grandfather, wininet, has more or less the same
> problem. That's genetic...or by design as we use to say here!"
> - I : "...the same old new thing..."
>
> Any idea?
>
> Pascal

Voilà! I reinvented the wheel...
Author
2 Nov 2007 3:43 PM
Dominik Jessn
Nice story... I'm already sleeping...

If you realy need the solution see the link bellow:

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=499572&SiteID=1

I'm afraid that some people just want to see your names on forums.

dominik jessn

*** Sent via Developersdex http://www.developersdex.com ***
Author
2 Nov 2007 5:59 PM
Pascal Soveaux
Dominik Jessn wrote:
> Nice story... I'm already sleeping...
>
> If you realy need the solution see the link bellow:
>
> http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=499572&SiteID=1
>
> I'm afraid that some people just want to see your names on forums.
>
> dominik jessn
>
> *** Sent via Developersdex http://www.developersdex.com ***
Thanks for this link.

I already discovered this workaround posted by Eric Cadwell on
connect.microsoft.com.

Too bad,I already implemented the whole thing.

Pascal

PS: I am afraid I do not understand your last sentence.
"I'm afraid that some people just want to see your names on forums." ?

AddThis Social Bookmark Button