AutoHotkey Community

It is currently May 26th, 2012, 8:06 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 233 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 16  Next

Should a more generic function be released which will include the already available web functions, such as header queries, uri encoding, base encoding, etc ?
yes, i'd like to have one function to get all neccessary http functionalities in one instead of collecting each for my own
no, i prefer collecting the functions i need
neither nor ... explained in post
You may select 1 option

View results
Author Message
 Post subject:
PostPosted: July 14th, 2009, 9:37 am 
Offline

Joined: January 9th, 2009, 10:42 pm
Posts: 104
Without the maxmem:

Code:
Error: Memory limit reached (see #MaxMem in the help file).  The current thread will exit.

   Line#
   124: {
   125: FileRead,file,%field_val%
   126: fileType := MimeType(file)
   127: SplitPath,field_val,filename
   128: FileGetSize,fileSize,%field_val%
   129: VarSetCapacity(placeholder, fileSize, 32) 
   131: postbody = %postbody%; filename="%filename%"

Content-Type: %fileType%

Content-Transfer-Encoding: Binary
--->   137: field_val := placeholder
   138: }
   139: postbody .= "



" . field_val . "


   140: }
   141: }
   142: postbody .= "--" boundary "--


   146: headers .= (StrLen(headers) ? "

" : "") . "Content-type: multipart/form-data; boundary=" boundary "

" . "Content-Length: " strlen(postbody) 
   150: if field_isFile 


With MaxMem, the results box is empty.. If ther rar file is small, the script works.. For a little time it takes about 400-500 MB of RAM..


The last Lines:
Code:
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
288: if (headerRequest=1) 
296: res := "timeout"
299: Loop,Parse,res,
,

301: RetValue := A_LoopField
302: Break
306: if (RetValue="timeout") 
307: html := "Error: timeout"
308: Return,-1
071: VarSetCapacity(result,-1) 
072: MsgBox,result (10.19)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 10:09 am 
Offline

Joined: July 9th, 2009, 9:25 pm
Posts: 120
JimKarvo wrote:
The last Lines:
Code:
...
284: if ((headerRequest:=DllCall("WinINet\HttpQueryInfoA","uint",hRequest,"uint",21,"uint",&header,"uint",&header_len,"uint",0))=1) 
288: if (headerRequest=1) 
296: res := "timeout"
299: Loop,Parse,res,
,

301: RetValue := A_LoopField
302: Break
306: if (RetValue="timeout") 
307: html := "Error: timeout"
308: Return,-1
071: VarSetCapacity(result,-1) 
072: MsgBox,result (10.19)

hmm, this shows that the http request is timing out. I think you'll have to use InternetSetOption to set INTERNET_OPTION_CONNECT_TIMEOUT but I can't help you with that, sorry.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 10:28 am 
Offline

Joined: January 9th, 2009, 10:42 pm
Posts: 104
I tryied to upload smaller files.. It can upload about 512 kb without problem.. :S

That means, that the script will don't work with big files, right? :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 12:21 pm 
Offline

Joined: January 9th, 2009, 10:42 pm
Posts: 104
Hm.. It seems that the script tryies to post all the content at once.. Maybe that's the reason that it takes a lot of memory, and it gets the timeout.. Is it possible to post a part of file every time?

Eg to post the firts 500 KB, then the second 500 KB etc..?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 2:03 pm 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
JimKarvo wrote:
Hm.. It seems that the script tryies to post all the content at once.. Maybe that's the reason that it takes a lot of memory, and it gets the timeout.. Is it possible to post a part of file every time?

Eg to post the firts 500 KB, then the second 500 KB etc..?



well,

here is the relevant section:

; <http://msdn.microsoft.com/en-us/library/aa384247(VS.85).aspx>
sRequest := DllCall("WinINet\HttpSendRequestA"
, "uInt",hRequest,"Str",Headers, "uInt",Strlen(Headers)
, "Str",POSTData,"uInt",Strlen(POSTData))


check out the msdn link.

what does it tell you ? Can you break up the sendRequest ?


What can you find on the ms site about increasing the timeout value ?


(Invest some real efforts/time/brain power and am happy to lend you a hand.)

Code:
untested:

varsetcapacity(ISOval,16,0)
NumPut(ISOval, 0xFFFFFFFF, 0, "INT")
DllCall("WinINet\InternetSetOptionA",uINT, hRequest, uINT, 5, UINTP, ISOval, uINT, 4)

prior to

   sRequest := DllCall("WinINet\HttpSendRequestA"
                  , "uInt",hRequest,"Str",Headers, "uInt",Strlen(Headers)
                  , "Str",POSTData,"uInt",Strlen(POSTData))

 

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 14th, 2009, 9:05 pm 
Offline

Joined: January 9th, 2009, 10:42 pm
Posts: 104
Joy2DWorld wrote:
what does it tell you ? Can you break up the sendRequest ?


What can you find on the ms site about increasing the timeout value ?




I didn't find any answer for that.. But I thing that the RapidUploader (Official) sends everytime a small amount of KB... (At the 1.2version, you could change the amount of KB to send everytime)

Yeap! Setting this option to infinite (0xFFFFFFFF) will disable this timer. But how? The script that you wrote, it can't run (It says thet the autohotkey program, must close, we are sorry for that etc..)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 15th, 2009, 12:51 am 
Offline

Joined: March 27th, 2009, 12:46 pm
Posts: 76
Location: Dublin, IE
Voltron43 wrote:
temp01 wrote:
Yes, replace line 140 in httpQuery.ahk:
Code:
RetValue := RegExReplace(RetValue,"\Q" ProVer "\E\s+")

with:
Code:
RetValue := RegExReplace(RetValue,"HTTP/1\.[01]\s+")


It now works, thanks!


Ok, now httpQuery returns the first call, but it does not update once the second call to the function is placed. Anybody have any ideas why?

_________________
My Scripts


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2009, 12:33 pm 
Offline

Joined: January 9th, 2009, 10:42 pm
Posts: 104
noone? :(


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 19th, 2009, 3:25 pm 
Offline

Joined: December 4th, 2006, 10:35 am
Posts: 561
Location: Galil, Israel
JimKarvo wrote:
The script that you wrote, it can't run It says thet the autohotkey program, must close, we are sorry for that etc..)


you ran the code as independent script ?

_________________
Joyce Jamce


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Nice, but
PostPosted: July 26th, 2009, 11:26 pm 
Ok to start, I really like this..

However I can't seem to figure out how to add a cookies tag to the header.

This is roughly what I need to simulate:

###
GET *some url* HTTP/1.1
Host: *some host*
User-Agent: *some agent*
Referer: *some referrer*
Cookie: *Cookie data*

###

This is the code I'm using:

headers := "Cookie: stuff"
length := httpQuery(data:="",URL,"",headers)

Other values seem to get passed except "Cookies:". So am I missing something? The inserted header doesn't end up on the bottom either, not sure if that would make a difference or not.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 30th, 2009, 10:10 pm 
Offline

Joined: January 8th, 2009, 12:42 am
Posts: 51
edit: sorry, please ignore


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Cookies
PostPosted: August 4th, 2009, 2:45 am 
So no-one has any idea why "cookie: " is being filtered from the headers?


Report this post
Top
  
Reply with quote  
 Post subject: Example I do not work
PostPosted: August 14th, 2009, 2:25 pm 
Offline

Joined: May 12th, 2009, 3:36 pm
Posts: 27
DerRaphael wrote:
Example I: Showing the raw HTML result of a search for httpQuery in AutoHotkey's forum in an edit control


I tried this example without any changes and get this output:
Image

However no problems with the third example:
"Example III: Downloading binary data and saving it to a local file."


So, what's going wrong?

Carlos


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 29th, 2009, 11:08 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
minor update 0.3.5

fixed the strip version bug as suggested by temp01 in this thread. thx

greets
dR

_________________
Image
    All scripts, unless otherwise noted, are hereby released under CC-BY


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Cookies
PostPosted: September 19th, 2009, 6:41 pm 
DerBen wrote:
So no-one has any idea why "cookie: " is being filtered from the headers?


+1
how set cookie?


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 233 posts ]  Go to page Previous  1 ... 5, 6, 7, 8, 9, 10, 11 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Exabot [Bot], notsoobvious, Uberi, wolverineks and 20 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group