Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Proxy & Keep-Alive cache #20

@seriyps

Description

@seriyps

This is not a issue, but discussion.

lhttpc_client.erl uses {Host, Port, Ssl} tuple for lookup keep-alive sockets in lhttpc_manager.erl
So:

  1. client connects to server {Host, Port, Ssl}
  2. server returns response and keep connection alive
  3. lhttpc keep open socket on lhttpc_manager under {Host, Port, Ssl} key
  4. client makes one more request to that host {Host, Port, Ssl} and can reuse this socket

But in case when proxy enabled, there is one more component that involved in the process:

  1. client connects to sever {Host, Port, Ssl} through proxy-server {PHost, PPort, PSsl}, by specifying proxy option
  2. server returns response and may keep connection alive; proxy keep connection with client alive
  3. lhttpc keep open socket (connected to proxy-server {PHost, PPort, PSsl}) under key {Host, Port, Ssl} !!!
  4. client makes one more connection to that host {Host, Port, Ssl}, but provide OTHER proxy option. But lhttpc_manager return cached connection to proxy-server {PHost, PPort, PSsl}

My suggestion: include proxy option in the cache key, eg host {Host, Port, Ssl, ProxyUrl}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions