• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Slowly HTTP/1.1

Participant ,
Apr 25, 2017 Apr 25, 2017

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

TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Apr 25, 2017 Apr 25, 2017

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

Votes

Translate

Translate
Guru ,
Apr 25, 2017 Apr 25, 2017

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
May 08, 2017 May 08, 2017

Copy link to clipboard

Copied

LATEST

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:

http://coppieters.nz/?p=133

Cheers,

Kris (Rorohiko)

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines