Removing WWW Server HEADERS from download GIF file 
Author Message
 Removing WWW Server HEADERS from download GIF file

Hi everybody!  Here's the challenge...  

 A VB4 program can correctly download a GIF (binary) file from a WWW
Server.

The GIF picture file is saved to the PC's Hard Disk.
But, any GIF viewing program "chokes" on the initial Server Header lines,
introduced by the WWW Server, ie:

HTTP/1.0 ...       <<< these are the Server Header lines
Date modified: 04/06/96
Data Type: ...
                   <<< a single blank line here, always separates the
                       Server Headers from the body, below>>>
GIF89.......       <<< here starts the *real* body of the GIF file

So, I how can I use VB to "parse-out" the initial Header lines,
and only save to file the text that begins with the chars "GIF89" ?
(That's the real body of the GIF file, viewable w/LviewPro, etc).

BTW, the downloaded data streams in in differnt chunks,
so I have to be able to parse out the initial Headers and separating
blank line "dynamically" (ie: as it streams in...).

BTW 2: No, I can't use HTTP/0.9, only HTTP/1.0...

Thanks for any concrete pointers.

RAY

San Francisco



Sun, 25 Oct 1998 03:00:00 GMT  
 Removing WWW Server HEADERS from download GIF file

(...)

Quote:
>The GIF picture file is saved to the PC's Hard Disk.
>But, any GIF viewing program "chokes" on the initial Server Header lines,
>introduced by the WWW Server, ie:

(...)

I was reading the HTTP 1.0  spec at
http://www.w3.org/hypertext/WWW/Protocols/HTTP/1.0/spec.html.

In section 6, it explains that a full HTTP response (1.0) will be
terminated by a CRLF pair. My experimentation showed that the web
server was return a double set of CRLF (chr$(13) + chr$(10) + chr$(13)
+ chr$(10) ) just before the body started.



Mon, 26 Oct 1998 03:00:00 GMT  
 Removing WWW Server HEADERS from download GIF file


Quote:
>Hi everybody!  Here's the challenge...      

> A VB4 program can correctly download a GIF (binary) file from a WWW
>Server.

>The GIF picture file is saved to the PC's Hard Disk.
>But, any GIF viewing program "chokes" on the initial Server Header lines,
>introduced by the WWW Server, ie:

>HTTP/1.0 ...       <<< these are the Server Header lines
>Date modified: 04/06/96
>Data Type: ...
>                   <<< a single blank line here, always separates the
>                       Server Headers from the body, below>>>
>GIF89.......       <<< here starts the *real* body of the GIF file

>So, I how can I use VB to "parse-out" the initial Header lines,
>and only save to file the text that begins with the chars "GIF89" ?
>(That's the real body of the GIF file, viewable w/LviewPro, etc).

Do you receive the characters one at a time?  (or, can you), if so, do something
like this:

X = GetNewCharacter

Do
  Window = Right$(Window & X,5)
  If StoreData Then
    Store X
  End IF
  If Window="GIF89" Then
    StoreDate = True
    Store Window
  End IF
  X = GetNewCharacter
Loop Until End Of Transmission

Window will always be the last (at most) 5 read characters.  When it becomes
"GIF89", you know you're at the start of the data you want to save.  First, tell
the loop you want to start saving data, and then store the "GIF89".  On
subsequent loops, X will be stored each time.

Eric Rossing
Intec Company, Inc.

http://www.msen.com/~rossing



Mon, 26 Oct 1998 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Automating IE, and downloading a www gif.

2. How to download files from the WWW using VB6

3. How to read a gif file header?

4. Downloading the first part of a file / the header

5. Downloading the first part of a file / the header

6. Downloading the first part of a file / the header

7. Pulling Header information BEFORE downloading file??

8. ? How to download gif file with WinInt ?

9. ? How to download gif file with WinInt ?

10. http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu http://www.besamung.de.vu

11. Saving a www file on a remote server locally on my PC using VB

 

 
Powered by phpBB® Forum Software