Copy link to clipboard
Copied
Hi
When i use HTTP/1.1 protocol version response is very slowly
When i use HTTP/1.0 protocol version response is fast
Can i modify script to use protocol HTTP/1.1 fast ??
conn = new Socket;
if (conn.open(parseUrl.host + ':' + parseUrl.port, "BINARY")) {
var request =
"GET /" + parseUrl.path + " HTTP/1.0\r\n" +
"Host: " + parseUrl.host + ':' + parseUrl.port + "\r\n" +
"User-Agent: InDesign ExtendScript\r\n" +
"Accept: text/xml,text/*,*/*\r\n" +
"Accept-Encoding:\r\n" +
"Connection: keep-alive\r\n" +
"Accept-Language: *\r\n" +
"Accept-Charset: utf-8\r\n\r\n";
alert(request);
conn.write(request);
var reply = conn.read(999999);
var response = getBodyFromResponse(reply);
conn.close();
return response;
Thanks
1 Correct answer
Hi Robert
For starters replace var reply = conn.read(999999); with var reply = conn.read();
If that doesn't help then there's a few http helpers out there.
Marc just release one in his new framework [ANN] IdExtenso: InDesign JSX Framework
There's Kris's one Rorohiko: GetURLs.jsx - access HTTP content from InDesign ExtendScript
And there's Porkie's porky | JavaScript database interface & functions library for Adobe® InDesign®
I don't know if they deal will 1 or 1.1 but it's a good start.
HTH
Trevor
Copy link to clipboard
Copied
Hi Robert
For starters replace var reply = conn.read(999999); with var reply = conn.read();
If that doesn't help then there's a few http helpers out there.
Marc just release one in his new framework [ANN] IdExtenso: InDesign JSX Framework
There's Kris's one Rorohiko: GetURLs.jsx - access HTTP content from InDesign ExtendScript
And there's Porkie's porky | JavaScript database interface & functions library for Adobe® InDesign®
I don't know if they deal will 1 or 1.1 but it's a good start.
HTH
Trevor
Copy link to clipboard
Copied
Hi all,
Just a quick note: I've revisited the old GetURL and made a more modern version which does support https as well as http. All smoke and mirrors. More information and source code on my personal blog:
Cheers,
Kris (Rorohiko)