AutoHotkey Community

It is currently May 27th, 2012, 12:48 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 228 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15, 16  Next
Author Message
 Post subject:
PostPosted: February 4th, 2012, 3:10 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
That's very strange. Does the error still happen on HttpSendRequestEx? or on a different function?

I don't have a x64 machine to test on, so if you're up to a little trial and error, play with the setup of the INTERNET_BUFFERS struct (line 530) and let me know if you find a winning combination.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2012, 4:19 am 
It's still HttpSendRequestEx
I wish I knew what I was doing when it comes to NumPut and buffer sizes, but I honestly never used it before :oops: I think it's definately that buffer though, because I tried messing around with some of the parameters in the DllCall to HttpSendRequestEx, but it didn't make a difference.

Found a thread where somebody else was experiencing that error also


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2012, 1:34 pm 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
That particular complaint is plastered all over the internet. Fully half of google's results pointed to some variation of that thread (on different sites). None of them offered solutions.

So, shooting fish in the dark...
Code:
NumPut( 28 + PtrSize * 3, INTERNET_BUFFERS, 0, "Int" ) ; <- find this line
NumPut( 40, INTERNET_BUFFERS, 0, "Int" ) ; <- add this line below it

Hypothesis: if HttpSendRequestEx was not correctly modified for x64, it may still expect the dwStructSize member of INTERNET_BUFFERS to show the 32 bit size.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 5th, 2012, 2:00 pm 
Yeah, I noticed the thread didn't have a solution, thought it might offer another way to look at the problem, but it wasn't much.

I tried pasting that line below the one indicated, still no change. I know M$ doesn't have the best track record for bug free softward lol, but all the same, it might be easier to assume it's working correctly from the start. Are there any working examples of HttpSendRequestEx on a 64 bit OS somewhere else? I still find it odd that the old function worked in 32bit XP, but the newer stopped working in the same OS before I switched to Windows 7 64bit. I don't know if you keep old versions around, but if not, I can upload it.

I really do like your function a lot and it's a core part of downloading app I've been working on, as I can't find anything else to easily let me do an HTTP POST in AHK_L.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 6th, 2012, 12:21 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
ToonyTom wrote:
Are there any working examples of HttpSendRequestEx on a 64 bit OS somewhere else?
None that I found provided any useful information (e.g: most languages have built-in oop, hiding 'deep' info).

ToonyTom wrote:
I still find it odd that the old function worked in 32bit XP, but the newer stopped working in the same OS before I switched to Windows 7 64bit.
Which version? Prior to decimals, the versions were marked by release date. I can't reproduce any problems with uploading data using HTTPRequest v2.43 (AHK basic, or AHK-L 1.1.00.00 unicode 32bit).

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2012, 4:43 am 
It's some version from 2011. I just installed Windows XP on VMware along with AHK basic, and it works. You may want to try VMware for testing on Windows 7 64 bit, it's super handy. Here's the old version of your function: http://dl.dropbox.com/u/43927622/apps/H ... ersion.ahk

If you want, I can make a test script for you. I'm only testing it on one site atm. When you first visit, it gives you a cookie, then when you POST your login data and some other details it gives you the second cookie. I can always get the first cookie but not the second on the new HTTPRequest.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2012, 6:03 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
Thanks, I would like to know more about how you set up the HTTPRequest call, since some features don't come into play unless specifically invoked.

For instance, if you're going to be handling cookies, it's a good idea to use the "+NO_COOKIES" option, even though it gets added anyways if you are submitting cookies. Logging into a website may require you to submit the cookies you received earlier.

The only real difference I can see between that old version and the current one is this:
Code:
VarSetCapacity( INTERNET_BUFFERS, 40, 0 )
NumPut( 40, INTERNET_BUFFERS, 0, "Int" )
NumPut( Content_Length, INTERNET_BUFFERS, 28, "Int" )
Maybe the struct isn't supposed to change in x64 versions...

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 7th, 2012, 8:19 am 
http://dl.dropbox.com/u/43927622/apps/H ... d_TEST.ahk

There you go. The only catch is, you'll have to register at https://www.furaffinity.net/ to test it since I'd rather not post my login info 8) I hope you understand. I'm using the "+NO_COOKIES" option also.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 3:31 am 
I did some more testing. Here's what i found:

on Windows 7 64bit with AHK_L Unicode:
The new function fails to POST with error 87
The new function with header Content-Type: text/xml charset=UTF-8 fails to POST with error 87
Running the old function test ahk throws
Code:
 Error: Duplicate declaration
Specifically: URL_Components, INTERNET_OPEN, TYPE_DIRECT:=1, INTERNET_OPEN_TYPE_PROXY:=3,hModule:=0,INTERNE....

Line#
142:WorA:=""
142:ModuleName:="WinINet.dll"

The old function compiled from XP with header Content-Type: text/xml charset=UTF-8 never gets the second cookie but no error 87
Running the new function with AutoHotKey.exe from AHK Basic fails to get cookie but no error 87 with or without Content-Type: text/xml charset=UTF-8
Running the old function with AutoHotKey.exe from AHK Basic fails to get cookie but no error 87 with or without Content-Type: text/xml charset=UTF-8

On Windows XP with AHK Basic:
The old function works
The new function works


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 4:21 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
I can't get your test script to work at all ('cookie_a' is never returned). I tried using every version of HTTPRequest that I have (making sure to use the correct codepage options for each). Here's the throw-away account I made for that site (name= pokmijn, pw= zxcvbnm). I tried it with AHK v1.0.48.05 and AHK-L v1.1.0.0 Unicode (32 bit).

For simplicity's sake, could you use this example for testing?
Code:
; HTTPRequest Example: submit POST data (SOAP XML) to a website
Gui, Font, S11, Lucida Bright
Gui, Margin, 3, 3
Gui, Add, Text, w657 h22 center 0x200, Fahrenheit to Celcius API example.
Gui, Add, Edit, xm w215 h22 vdegf right section
Gui, Add, Button, ys w215 h22 default gdoit, Convert
Gui, Add, Edit, ys w215 h22 vdegc right
Gui, Add, Edit, xs w657 r20 vhdrbox
Gui, Show,, Simple API Example.
Return
GuiClose:
Exitapp

doit:
   Gui, Submit, NoHide
   API_EndPoint := "http://www.w3schools.com/webservices/tempconvert.asmx"
   Headers := "Content-Type: application/soap+xml"
   Data =
   ( LTRIM JOIN
      <?xml version="1.0" encoding="utf-8"?>
      <soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
         <soap12:Body>
            <FahrenheitToCelsius xmlns="http://tempuri.org/">
               <Fahrenheit>%degf%</Fahrenheit>
            </FahrenheitToCelsius>
         </soap12:Body>
      </soap12:Envelope>
   )
   size := HTTPRequest( API_EndPoint, Data, Headers, "charset=utf-8" )
   StringLeft, Data, Data, InStr( Data, "</Fahre" ) - 1
   StringTrimLeft, Data, Data, InStr( Data, ">", 0, 0 )
   GuiControl,, degc, % Data
   GuiControl,, hdrbox, % Headers
Return


HttpSendRequestEx shouldn't care about the actual POST data aside from its length (as a member of INTERNET_BUFFERS) so I would like to concentrate on that function and its input. What happens when you hardcode the INTERNET_BUFFERS at size 40? (like the code in my previous post).

Another thing to try is changing the very last (Ptr) to ("UInt") for HttpSendRequestEx. It violates the parameter's description on MSDN, ...but if it works....

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Last edited by [VxE] on February 17th, 2012, 7:50 am, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 5:24 am 
With your test script in with AHK_L Unicode Windows 7 64bit it outputs:
There was a problem sending the POST request. 'WinINet\HttpSendRequestExW' failed: ErrorLevel = 0, A_LastError = 87

With your test script in with AHK Basic Windows XP 32bit it outputs:
HTTP/1.1 200 OK
Date: Thu, 09 Feb 2012 04:06:16 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 387


Running your test script with the AHK Basic exe in Windows 7 64bit it outputs:
HTTP/1.1 200 OK
Date: Thu, 09 Feb 2012 04:06:31 GMT
Server: Microsoft-IIS/6.0
MicrosoftOfficeWebServer: 5.0_Pub
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
Cache-Control: private, max-age=0
Content-Type: application/soap+xml; charset=utf-8
Content-Length: 387


Changing the INTERNET_BUFFERS from:
Code:
VarSetCapacity( INTERNET_BUFFERS, 28 + PtrSize * 3, 0 )
NumPut( 28 + PtrSize * 3, INTERNET_BUFFERS, 0, "Int" )
NumPut( Content_Length, INTERNET_BUFFERS, 16 + PtrSize * 3, "Int" )

to this:
Code:
VarSetCapacity( INTERNET_BUFFERS, 40, 0 )
NumPut( 40, INTERNET_BUFFERS, 0, "Int" )
NumPut( Content_Length, INTERNET_BUFFERS, 28, "Int" )

Still gives error 87

Also changing the very last (Ptr) to ("UInt") in HttpSendRequestEx still gets error 87

Maybe....all this is a problem with AHK_L unicode?
BTW, your FA test account works in AHK Basic with XP, the same as mine did, same error in 64bit AHK_L also.


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 9th, 2012, 10:49 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
I don't see how unicode would effect HttpSendRequestEx since headers and post data are handled separately.

Well, I'm running out of ideas. If the problem does lie in the structure, then perhaps a brute force approach will yield something.

The majority of the struct is zeros, only two members should be set. First is the struct size, which is an "int" type at offset zero. Second is the size of the POST data, which is another "int" at an offset equal to the struct size minus 12.

Try adjusting the struct size by multiples of 4 and see if any of them work.
Code:
      ib_size := 40 ; 44, 48, 52, 56, 60
      VarSetCapacity( INTERNET_BUFFERS, ib_size, 0 )
      NumPut( ib_size, INTERNET_BUFFERS, 0, "Int" )
      NumPut( Content_Length, INTERNET_BUFFERS, ib_size - 12, "Int" )

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2012, 3:36 am 
I'm trying to read a FB page feed, but I'm not able to get the source. Anyone know why? I tried this, but data is empty after the httprequest.

Code:
url := "http://www.facebook.com/feeds/page.php?id=6185812851&format=rss20"

httprequest( url, data )


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 16th, 2012, 3:45 am 
Please ignore. Updating to the latest HTTPRequest version solves the problem.

guestpost wrote:
I'm trying to read a FB page feed, but I'm not able to get the source. Anyone know why? I tried this, but data is empty after the httprequest.

Code:
url := "http://www.facebook.com/feeds/page.php?id=6185812851&format=rss20"

httprequest( url, data )


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 17th, 2012, 10:54 am 
Offline
User avatar

Joined: October 7th, 2006, 8:45 am
Posts: 3330
Location: Simi Valley, CA
@ ToonyTom: Thanks to fragman, I'm pretty sure I've resolved the x64 issue. Please try version 2.44 (available from the links in the OP).

The problem was indeed the INTERNET_BUFFERS struct.

The miscalculated struct size was probably why HttpSendRequestEx failed with error 87 (invalid parameter).


@ guestpost: a general rule of thumb when using HTTPRequest is to provide a variable for the output headers. If there is a problem, you'll probably find very helpful info in that variable.

_________________
Ternary (a ? b : c) guide     TSV Table Manipulation Library
Post code inside [code][/code] tags!


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 228 posts ]  Go to page Previous  1 ... 9, 10, 11, 12, 13, 14, 15, 16  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], Bon, bowen666, Yahoo [Bot] and 18 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:
cron
Powered by phpBB® Forum Software © phpBB Group