I've been working on some project that requires a lot of internet reading. Recently its become bloated and churns a large amount of bw from my connection so i was going to add a function in to determine if a site has been updated so as to read it or not. I searched this forum and not found anything directly with what im doing with HttpQueryInfoA.. Trying to find the last modified date and its simply not working! :(
invoke HttpQueryInfoA, hUrl, HTTP_QUERY_LAST_MODIFIED, offset modibuf, addr
pdwBufferLength, addr lpPointer
maybe theres a problem i dunno it returned a error code that a friend told me ment header not found. But if i use firefox on the example site it tells me without worries what the last modified date was. But this does not
Any ideas?
Posted on 2004-08-12 05:13:37 by Uradox
Hi, I don't know anything about HttpQueryInfoA, but I did a similar thing by using simple send and recv. Send a HTTP request like:

sModifiedSinceDate db "Sun, 14 Mar 2004 18:18:18 GMT",0

g_request_part1 db "GET [url]http://www.someFullyQualifiedURI.com[/url] HTTP/1.1",CR,LF
db "Host: ",CR,LF ; Can be blank if complete URI supplied.
db "User-agent: MiscUpdateTest",CR,LF ; Specify user agent.
db "Connection: close",CR,LF
db "If-Modified-Since: "
REQUEST_SIZE1 equ $ - g_request_part1 ; Size of request part1 in bytes.

g_request_part2 db CR,LF ; End If_Modifi... header from part1.
db CR,LF ; Empty line indicating the end of the request.
REQUEST_SIZE2 equ $ - g_request_part2 ; Size of request part2 in bytes.

.code ; Note just a snippet.
;---------- [Send request part 1:] ----------
invoke send,esi,ADDR g_request_part1,REQUEST_SIZE1,0
mov ecx,OFFSET g_errSend
je _error

;---------- [Send request modified since date:] ----------
invoke send,esi,ADDR sModifiedSinceDate,SIZEOF sModifiedSinceDate-1,0
mov ecx,OFFSET g_errSend
je _error

;---------- [Send request part 2:] ----------
invoke send,esi,ADDR g_request_part2,REQUEST_SIZE2,0
mov ecx,OFFSET g_errSend
je _error

Then parse the response.
Posted on 2004-08-12 05:34:01 by adamjjackson
ok cool i will look into that tho doesnt seem very efective of me to use two diffirent methods to read info from a site
WIll that work with something like www.sdjfsdf.com/program/whatsnew.html instead of just the domain?
Posted on 2004-08-12 08:20:15 by Uradox
I have problems also with
g_request_part2 db CR,LF
is there some macro or something to use that CR LF stuff u have?
Posted on 2004-08-12 09:02:38 by Uradox
Yeah sorry, they're defined in the data section:

CR equ 0Dh
LF equ 0Ah

- just the ASCII carriage return and linefeed characters.

Not certain that my approach is the best btw. I assume you have seen the HTTP rfc: http://www.w3.org/Protocols/rfc2616/rfc2616.html

Posted on 2004-08-12 11:01:22 by adamjjackson
Yes i have looked at this.
I was hoping to sticking to that httpquery api but its being such a problem ;
Also when i try to compile i get an error:
Resolve.obj : error LNK2001: unresolved external symbol _send@16
Resolve.exe : fatal error LNK1120: 1 unresolved externals

doesnt like that send? :|
Posted on 2004-08-13 07:46:45 by Uradox
Sorry, I can't really help you with that. Don't know too much about it myself!
Posted on 2004-08-14 03:54:46 by adamjjackson
include the winsock related files to your code
Posted on 2004-08-14 09:37:35 by roticv
i attually did that :(
Posted on 2004-08-16 05:18:32 by Uradox
Uradox, did you add ws2_32.lib to your linker commandline (or includelib ws2_32.lib in the asm source)?
Posted on 2004-08-16 06:10:29 by f0dder
BINGO that was my problems :P thanks
Posted on 2004-08-16 09:02:59 by Uradox
Glad to have helped
Posted on 2004-08-16 09:18:38 by f0dder