headers respond
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
headers respond
I have to download a file from a link in this link if called httpheaders the link redirects to the server, and then starts the download, if I insert "LibUrlFollowRedirects false" then the response headers I see the link of the server, but if I leave "LibUrlFollowRedirects true "in the header can not see the file name, that I need to insert it later in the" LibUrlDownloadToFile "as the name of the file to salvare.Il first link I can not use it because it serves only as a redirect, the second link works with" LibUrlDownloadToFile "but i have not the name that appears to be in the header, if I use" get url (linkname2) "to have httpheders with the name LiveCode remains very slow because you download the entire file into memory before to give me back the headers.
How do I get the headers without downloading the file first?
I hope I have explained my problem well
How do I get the headers without downloading the file first?
I hope I have explained my problem well
Re: headers respond
I found this solution, however, are not happy with this, then I download the file with (liburldownloadtofile turl,tname, "downloadDone") after I extract the name from the header Respond, and rename the file.
But I wish I could first see the name of the file and then download.
Someone suggests to me other ideas.
;)
But I wish I could first see the name of the file and then download.
Someone suggests to me other ideas.
;)
Re: headers respond
Hi boysky76,
How is the redirect being done? In meta tags, javascript etc.
What is the URL of the first link?
Simon
How is the redirect being done? In meta tags, javascript etc.
What is the URL of the first link?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: headers respond
hi,
the first link is : http://w w w.sitename.com/ddl2/aHR0cDovL3d3dy5ub3d2aWRlby5jaC92aWRlby9kMWQzN2U3NTg0Nzg5fDcyNzg4fDFxd2VydHl8
Get Url (link1)
this is the http respond headers and contains the redirect url
--HTTP/1.1 302 Found
Date: Tue, 05 Nov 2013 12:21:48 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.3.17
X-Powered-By: PHP/5.3.17
Location: http://nl1a.sitename.com/name.php?type= ... I3MzQ2NDM=
Content-Length: 0
Connection: close
Content-Type: text/html--
if i set libURLFollowHttpRedirects false I can extract the location and put thsi in "tlocation" and use liburldownloadtofile (tlocation,tfilename) for download the file.
If I set libURLFollowHttpRedirects true livecode freezes or slows down because it is a large file and need "liburldownloadtofile" for download
but before to download i need extract the "Content-Disposition: " present in the http headers But I can see that only after I run the command "get" or "liburldownloadtofile" with the tlocation
HTTP/1.1 200 OK
Date: Tue, 05 Nov 2013 12:21:46 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.3.21
X-Powered-By: PHP/5.3.21
Content-Disposition: attachment; filename="ff4e219a21ed3e22cf68dba97753b9cb0c.flv"
Etag: "3524601224"
Accept-Ranges: bytes
Last-Modified: Mon, 05 Aug 2013 14:26:34 GMT
Expires: Wed, 06 Nov 2013 04:21:10 GMT
Cache-Control: max-age=28800
Content-Length: 115991455
Connection: close
Content-Type: application/octet-stream
----------------
the first link is : http://w w w.sitename.com/ddl2/aHR0cDovL3d3dy5ub3d2aWRlby5jaC92aWRlby9kMWQzN2U3NTg0Nzg5fDcyNzg4fDFxd2VydHl8
Get Url (link1)
this is the http respond headers and contains the redirect url
--HTTP/1.1 302 Found
Date: Tue, 05 Nov 2013 12:21:48 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/0.9.8e-fips-rhel5 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.3.17
X-Powered-By: PHP/5.3.17
Location: http://nl1a.sitename.com/name.php?type= ... I3MzQ2NDM=
Content-Length: 0
Connection: close
Content-Type: text/html--
if i set libURLFollowHttpRedirects false I can extract the location and put thsi in "tlocation" and use liburldownloadtofile (tlocation,tfilename) for download the file.
If I set libURLFollowHttpRedirects true livecode freezes or slows down because it is a large file and need "liburldownloadtofile" for download
but before to download i need extract the "Content-Disposition: " present in the http headers But I can see that only after I run the command "get" or "liburldownloadtofile" with the tlocation
HTTP/1.1 200 OK
Date: Tue, 05 Nov 2013 12:21:46 GMT
Server: Apache/2.2.23 (Unix) mod_ssl/2.2.23 OpenSSL/1.0.0-fips mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 PHP/5.3.21
X-Powered-By: PHP/5.3.21
Content-Disposition: attachment; filename="ff4e219a21ed3e22cf68dba97753b9cb0c.flv"
Etag: "3524601224"
Accept-Ranges: bytes
Last-Modified: Mon, 05 Aug 2013 14:26:34 GMT
Expires: Wed, 06 Nov 2013 04:21:10 GMT
Cache-Control: max-age=28800
Content-Length: 115991455
Connection: close
Content-Type: application/octet-stream
----------------
Re: headers respond
Actually I was hoping you would post the actual URL you are using. Can't try to help without knowing what is going on.
Simon
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: headers respond
Hi boysky76,
I've got an answer for you ... might not be a good answer.
Here are the commands I used, see if you can put it together in your stack.
libURLSetLogField --Specifies a field for logging information about uploads and downloads. like the headers
resetAll --Closes all open sockets and halts all pending Internet operations. Lets you stop a download
Now with just those two can you figure out a way to make them work to grab the .flv name?
Simon
I've got an answer for you ... might not be a good answer.
Here are the commands I used, see if you can put it together in your stack.
libURLSetLogField --Specifies a field for logging information about uploads and downloads. like the headers
resetAll --Closes all open sockets and halts all pending Internet operations. Lets you stop a download
Now with just those two can you figure out a way to make them work to grab the .flv name?
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: headers respond
Hi simon
thanks for the answers, but even if I use "resetall" LiveCode appears to hang or rellentare very much as if the memory was not freed and called Get the url (link) to continue to load the data into memory, slowing everything
thanks for the answers, but even if I use "resetall" LiveCode appears to hang or rellentare very much as if the memory was not freed and called Get the url (link) to continue to load the data into memory, slowing everything
Re: headers respond
I used put url "http://your_link" into temp
then resetAll
That was working here.
Simon
then resetAll
That was working here.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
Re: headers respond
To me it keeps crashing the stack, as if the "resetall" fails to close all sockets.
the browser can read this header and take the name, I should simulate this. Basically something like this:
Liburldownloadtofile Link, tname (headers to extract libUrlLastRHHeaders), "DownloadDone"
the browser can read this header and take the name, I should simulate this. Basically something like this:
Liburldownloadtofile Link, tname (headers to extract libUrlLastRHHeaders), "DownloadDone"
Re: headers respond
Try the attached stack and tell me what happens.
In the button script there is a time delay which you may have to adjust.
Simon
In the button script there is a time delay which you may have to adjust.
Simon
- Attachments
-
- sockets.zip
- LC 6.1.2
- (1.36 KiB) Downloaded 231 times
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!
-
- Posts: 78
- Joined: Wed Apr 10, 2013 9:08 pm
Re: headers respond
Watching with interest as I am doing something similar.
Returning to try to learn livecode again.
But much greyer at the temples than the last time.
But much greyer at the temples than the last time.
Re: headers respond
the script you sent me works, I thank you, the problem is that I now have, is that my application should extract different url one after the other and when you run the first time the command "resetall" I closed everything and I should start the script again, but by doing restart takes up the first url and not the second. (it is a bit 'complicated)
Re: headers respond
Hello boysky76,
I'm not clear on the problem you are having. Is it just a repeat loop you are asking about?
If so just stick your url's into a variable and loop through the code.
Simon
I'm not clear on the problem you are having. Is it just a repeat loop you are asking about?
If so just stick your url's into a variable and loop through the code.
Simon
I used to be a newbie but then I learned how to spell teh correctly and now I'm a noob!