0

Is there any way we could get directly say the 1000 characters after the first 5000 characters, skipping everything before that after sending in an HTTP request to an HTTPS page using either GET or POST in VB.NET?

The reason why I ask this question is because in one of the webpage I am trying the get through my program, the website is sending response data in chunks with the first chunk containing some javascript garbage that I have no interest in, the only data I care is in the second chunk and

  1. I have no idea how to get the second chunk after receiving the first one since it is within the same HTTP request

  2. It would save some time and Internet traffic if I can skip the first chunk that I do not need.

Is that possible or I am just day dreaming?

Many thanks!

ADDED: Here is how a typical header of the response I am getting from the webpage I am trying to get:

Date: Mon, 20 Jun 2011 13:21:56 GMT
Set-Cookie: JSESSIONID=1AF1AF9EF936E1CB2FA85B750EDC67C4; Path=****some path******; Secure
Content-Type: text/html; charset=ISO-8859-1
Transfer-Encoding: chunked
Set-Cookie: **********some cookie***************
path=/
Vary: Accept-Encoding, User-Agent

Not sure if that helps, but as you can see, the chunk size is not visible to me, there is no "Trailer" in the header as well.

AZhu
  • 1,312
  • 6
  • 22
  • 40
  • You could do it if both client and server apps under your control :p – Predator Jun 17 '11 at 03:29
  • @Gens: haha, I really wish, but no, I have complete control on the client side (since I wrote the code, but 0 control on the server side) – AZhu Jun 17 '11 at 03:55

1 Answers1

0

Fun little problem. Look at RANGE in the following GET request.

GET /file.txt HTTP/1.1  
Host: localhost  
Range: bytes=5000-6000  
Connection: Close 

Edit: Found a HTTP example. Here is an example in PHP. (Sorry I couldn't find any VB.NET examples).

agent-j
  • 27,335
  • 5
  • 52
  • 79
  • thanks for finding things out for me, I think PHP/Curl makes the whole thing a lot easier...but not sure how to implement such in .NET though, especially since the range is not visible to me. – AZhu Jun 20 '11 at 13:34
  • You could implement it yourself with sockets (TcpClientSocket). Shouldn't be that hard, but it might not be worth it. – agent-j Jun 20 '11 at 14:40