|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
HttpWebRequest inconsistency 8-[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 Pascal Soveaux wrote:
Show quote > Hi, Voilà! I reinvented the wheel...> > 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 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 *** Dominik Jessn wrote:
> Nice story... I'm already sleeping... Thanks for this link.> > 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 *** 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." ? |
|||||||||||||||||||||||