AutoHotkey Community

It is currently May 27th, 2012, 4:53 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 233 posts ]  Go to page Previous  1 ... 7, 8, 9, 10, 11, 12, 13 ... 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: March 5th, 2010, 9:30 am 
Offline

Joined: November 7th, 2006, 9:47 pm
Posts: 1934
Location: Germany
What is the license text for the used zLib-Style release, which the library is licensed under? Means the Style postfix that it is not exactly the zlib license? Or does it mean equally the same?

http://en.wikipedia.org/wiki/Zlib_License ?

_________________
{1:"ahkstdlib", 2:"my libs", 3:"my apps", 4:"my license"}
--> Don't feed the troll! <--


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 5th, 2010, 10:45 am 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
http://www.opensource.org/licenses/zlib-license.php

zLib Style Licence wrote:
Copyright (c) 2010 derRaphael & Heresy

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:
  • The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  • Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  • This notice may not be removed or altered from any source distribution.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 8:27 am 
Offline

Joined: February 20th, 2008, 5:08 pm
Posts: 111
Nozavi wrote:
Any ideas on how I can stop my app from crashing because of this error?
Image

Nobody? :(
DerRaphael?

_________________
My scripts: http://apps.nozavi.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 9:56 am 
what exactly are you trying to do? this error msg may be a result from many different possibilities.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 10:45 am 
Offline

Joined: February 20th, 2008, 5:08 pm
Posts: 111
dR* wrote:
what exactly are you trying to do? this error msg may be a result from many different possibilities.

The app just downloads some wallpapers (see here), but once in a while it crashes with this error (and as you can see here it's quite annoying)

_________________
My scripts: http://apps.nozavi.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 2:30 pm 
Two possibilities: The Variable which holds the wallpaper data doesn't get reset and by downloading many wallpapers it slowly gets outside the Maximum Memory Range of Variables, or the data it's loading is bigger than 64 mb.

Your able to set the capacity of variables using: #MaxMem Size in MB


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 3:06 pm 
Offline

Joined: February 20th, 2008, 5:08 pm
Posts: 111
Banane as Guest wrote:
Two possibilities: The Variable which holds the wallpaper data doesn't get reset and by downloading many wallpapers it slowly gets outside the Maximum Memory Range of Variables, or the data it's loading is bigger than 64 mb.

Your able to set the capacity of variables using: #MaxMem Size in MB

1. It doesn't download many wallpapers, it downloads them one by one... (the function doesn't make it to the next loop)
2. Impossible. Besides the fact that they're wallpapers, after restarting the app, the wallpaper is downloaded sucessfully...
As I said before, this does not happen every time I run the app or at a specific moment. From what I've noticed, the progress bar usually stops in the middle of a download while the memory starts going up...

_________________
My scripts: http://apps.nozavi.com


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Nice, but
PostPosted: April 2nd, 2010, 7:48 pm 
Ey buddy, I think you can manipulate the cookies using the http headers...

You can read the header, looking for the set-cookie statements (keep it a variable or file) and then send it to the web using the cookie statement...

This link probably will help you:

http://curl.haxx.se/rfc/cookie_spec.html

Header Examples:

HTTP/1.1 200 OK
Cache-Control: private, no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Expires: Sat, 01 Jan 2000 00:00:00 GMT
P3P: CP="DSP LAW"
Pragma: no-cache
Set-Cookie: reg_fb_ref=http%3A%2F%2Fwww.facebook.com%2F; path=/; domain=.facebook.com
Set-Cookie: test_cookie=1; path=/; domain=.facebook.com
Content-Encoding: gzip
Content-Type: text/html; charset=utf-8
X-Cnection: close
Date: Fri, 02 Apr 2010 17:52:43 GMT
Content-Length: 7924


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


DerBen wrote:
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: April 3rd, 2010, 2:13 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
a future version of httpQuery will have native build in cookie support aswell as other features like escape, unescape, mimetypes and multipart postings. for now only the basic capability is supported.

the problem with it is, that by including more features, the known syntax will break since the tweaks needed to incorporate these features will work on a different base. and most of the current code will have to be rewritten.

a major reason for rewriting the code is to make it standard lib compatible and to get rid of the current needed global variables, but use a more friendly http_init( "list of features, list of values" ).

for now these are only plans but i am curious to learn of how the community members who actually use this think about such an enhancement.

greets
dR

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: question...
PostPosted: April 6th, 2010, 2:23 pm 
hi buddy, Im implementing a simple cookie support, Im writing right now the regular expression to get all the Set-Cookies from the web sever (reading the http header)

Im using something like this:

Code:
Result := RegExpReplace(header, "s)Set-Cookie.+?;", "")


If I use this sentence, I will get everything except the cookies hehehe, Im not an expert using Reg Exp, there is a way to make a deny? I mean, replace everything except the values that match this pattern?

Thanks for your help

DerRaphael wrote:
a future version of httpQuery will have native build in cookie support aswell as other features like escape, unescape, mimetypes and multipart postings. for now only the basic capability is supported.

the problem with it is, that by including more features, the known syntax will break since the tweaks needed to incorporate these features will work on a different base. and most of the current code will have to be rewritten.

a major reason for rewriting the code is to make it standard lib compatible and to get rid of the current needed global variables, but use a more friendly http_init( "list of features, list of values" ).

for now these are only plans but i am curious to learn of how the community members who actually use this think about such an enhancement.

greets
dR


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2010, 6:05 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
quick and dirty cookie sampler:

Code:
HeaderData=
(Join`r`n
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2010 16:29:16 GMT
Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 PHP/5.2.13 mod_perl/2.0.4 Perl/v5.8.8
X-Powered-By: PHP/5.2.13
Set-Cookie: MyName=CookieMonster; path=/
Set-Cookie: SessionData=12345678901234567890123456789012; path=/
Content-Length: 154
Content-Type: text/html; charset=utf-8
)


MsgBox % CookiesFromHeader( HeaderData )


CookiesFromHeader( HeaderData )
{
   while ( p := RegExMatch( headerData, "sim)^Set-Cookie:\s*(?P<Crumb>[^;]+);", Cookie, ( p ? p+StrLen(Cookie) : 1 ) ) )
   {
      Cookies .= ( StrLen( Cookies ) ? " " : "" ) CookieCrumb ";"
   }

   return "Cookie: " Cookies
}


the return value of the CookiesFromHeader needs to be inserted as new headerdata for the next httpQuery call, so that the server learns about the cookies.

greets
dR

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: thank you very much
PostPosted: April 6th, 2010, 7:51 pm 
Thanks my friend... Im using your code like this:

Code:
#noenv
html     := ""
URL      := "http://www.google.com"
headers  := "Accept-Language: en-us,en;q=0.5"
POST     := ""
httpQueryOps := "storeHeader"
length := httpQuery(html,URL,POST, headers)
varSetCapacity(html,-1)

MsgBox % CookiesFromHeader( HttpQueryHeader )

CookiesFromHeader( headerData )
{
   while ( p := RegExMatch( headerData, "sim)^Set-Cookie:\s*(?P<Crumb>[^;]+);", Cookie, ( p ? p+StrLen(Cookie) : 1 ) ) )
   {
      Cookies .= ( StrLen( Cookies ) ? " " : "" ) CookieCrumb ";"
   }

   return "Cookie: " Cookies
}

#include httpQuery.ahk


And the result is empty, do you have any idea why?

Thanks for your help...

DerRaphael wrote:
quick and dirty cookie sampler:

Code:
HeaderData=
(Join`r`n
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2010 16:29:16 GMT
Server: Apache/2.2.15 (Unix) mod_ssl/2.2.15 OpenSSL/0.9.8e-fips-rhel5 mod_bwlimited/1.4 PHP/5.2.13 mod_perl/2.0.4 Perl/v5.8.8
X-Powered-By: PHP/5.2.13
Set-Cookie: MyName=CookieMonster; path=/
Set-Cookie: SessionData=12345678901234567890123456789012; path=/
Content-Length: 154
Content-Type: text/html; charset=utf-8
)


MsgBox % CookiesFromHeader( HeaderData )


CookiesFromHeader( HeaderData )
{
   while ( p := RegExMatch( headerData, "sim)^Set-Cookie:\s*(?P<Crumb>[^;]+);", Cookie, ( p ? p+StrLen(Cookie) : 1 ) ) )
   {
      Cookies .= ( StrLen( Cookies ) ? " " : "" ) CookieCrumb ";"
   }

   return "Cookie: " Cookies
}


the return value of the CookiesFromHeader needs to be inserted as new headerdata for the next httpQuery call, so that the server learns about the cookies.

greets
dR
Code:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: April 6th, 2010, 9:39 pm 
Offline

Joined: November 23rd, 2007, 10:23 am
Posts: 841
Location: ~/.
when using the parameter showHeader in addition to storeHeader

the headers give me the following:
script wrote:
---------------------------
httpQuery.cookies.ahk
---------------------------
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2010 20:27:11 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Server: gws
Transfer-Encoding: chunked
---------------------------
OK
---------------------------


by means, google doesn't send any cookies :)

but you're right. there is missing an paramater in the regex. below is the fixed, tested, and working version:

Code:
#noenv
URL      := "http://salt.autohotkey.com"
httpQueryOps := "storeHeader"
length := httpQuery(html,URL)

MsgBox % CookiesFromHeader( HttpQueryHeader )

CookiesFromHeader( headerData ) {
   while ( p := RegExMatch( headerData, "sim`a)^Set-Cookie:\s*(?P<Crumb>[^;]+);", Cookie, ( p ? p+StrLen(Cookie) : 1 ) ) )
      Cookies .= ( StrLen( Cookies ) ? " " : "" ) CookieCrumb ";"
   return "Cookie: " Cookies
}


greets
dR

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


Report this post
Top
 Profile  
Reply with quote  
PostPosted: April 7th, 2010, 8:46 am 
excellent buddy, thank you very much!!!

Its working flawless!!!



DerRaphael wrote:
when using the parameter showHeader in addition to storeHeader

the headers give me the following:
script wrote:
---------------------------
httpQuery.cookies.ahk
---------------------------
HTTP/1.1 200 OK
Date: Tue, 06 Apr 2010 20:27:11 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Server: gws
Transfer-Encoding: chunked
---------------------------
OK
---------------------------


by means, google doesn't send any cookies :)

but you're right. there is missing an paramater in the regex. below is the fixed, tested, and working version:

Code:
#noenv
URL      := "http://salt.autohotkey.com"
httpQueryOps := "storeHeader"
length := httpQuery(html,URL)

MsgBox % CookiesFromHeader( HttpQueryHeader )

CookiesFromHeader( headerData ) {
   while ( p := RegExMatch( headerData, "sim`a)^Set-Cookie:\s*(?P<Crumb>[^;]+);", Cookie, ( p ? p+StrLen(Cookie) : 1 ) ) )
      Cookies .= ( StrLen( Cookies ) ? " " : "" ) CookieCrumb ";"
   return "Cookie: " Cookies
}


greets
dR


Report this post
Top
  
Reply with quote  
PostPosted: April 12th, 2010, 5:41 pm 
DerRaphael your function is amazing, Have you implemented this function with threads? if you did it, can you give me an example? another question is, how you can manage the private proxies? (the one with username and password)

Thank you very much


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 ... 7, 8, 9, 10, 11, 12, 13 ... 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 13 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