Skip to content
This repository has been archived by the owner on Jul 13, 2021. It is now read-only.

SOCKS protocol error #106

Closed
brookhong opened this issue Oct 18, 2018 · 4 comments
Closed

SOCKS protocol error #106

brookhong opened this issue Oct 18, 2018 · 4 comments

Comments

@brookhong
Copy link

I'm using polipo to convert a sock5 proxy to http proxy. The socks5 proxy works fine as below

curl -v --socks5-hostname xx.xx.xx.xx:1080 https://www.google.com

But I got SOCKS protocol error when using http proxy from polipo.

  1. start polipo

    polipo socksProxyType=socks5 socksParentProxy=xx.xx.xx.xx:1080 proxyAddress="0.0.0.0"

  2. use the http proxy

    curl -v -x 127.0.0.1:8123 https://www.google.com

     * Rebuilt URL to: https://www.google.com/
     *   Trying 127.0.0.1...
     * TCP_NODELAY set
     * Connected to 127.0.0.1 (127.0.0.1) port 8123 (#0)
     * Establish HTTP proxy tunnel to www.google.com:443
     > CONNECT www.google.com:443 HTTP/1.1
     > Host: www.google.com:443
     > User-Agent: curl/7.54.0
     > Proxy-Connection: Keep-Alive
     > 
     < HTTP/1.1 504 Couldn't connect: SOCKS protocol error
     < Connection: close
     < Date: Thu, 18 Oct 2018 15:18:01 GMT
     < Content-Type: text/html
     < Content-Length: 475
     < Expires: 0
     < Cache-Control: no-cache
     < Pragma: no-cache
     < 
     * Received HTTP code 504 from proxy after CONNECT
     * Closing connection 0
     curl: (56) Received HTTP code 504 from proxy after CONNECT
    
@tmaly1980
Copy link

Did you ever get this working? Have you tried HTTP rather than HTTPS? I read in another bug report that HTTPS is not supported.

@rampageX
Copy link

Working here:

polipo -c /opt/etc/polipo/config

Established listening socket on port 56789.
tunnel www.google.com:443 allowed
tunnel www.twitter.com:443 allowed

curl -v -I -x 127.0.0.1:56789 https://www.google.com

*   Trying 127.0.0.1:56789...
* TCP_NODELAY set
* Connected to 127.0.0.1 (127.0.0.1) port 56789 (#0)
* allocate connect buffer!
* Establish HTTP proxy tunnel to www.google.com:443
> CONNECT www.google.com:443 HTTP/1.1
> Host: www.google.com:443
> User-Agent: curl/7.67.0
> Proxy-Connection: Keep-Alive
>
< HTTP/1.1 200 Tunnel established
HTTP/1.1 200 Tunnel established
<

* Proxy replied 200 to CONNECT request
* CONNECT phase completed!
* ALPN, offering http/1.1
* successfully set certificate verify locations:
*   CAfile: /opt/etc/ssl/certs/ca-certificates.crt
  CApath: /mmc/ssl/certs
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* CONNECT phase completed!
* CONNECT phase completed!
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.3 (IN), TLS handshake, CERT verify (15):
* TLSv1.3 (IN), TLS handshake, Finished (20):
* TLSv1.3 (OUT), TLS change cipher, Change cipher spec (1):
* TLSv1.3 (OUT), TLS handshake, Finished (20):
* SSL connection using TLSv1.3 / TLS_AES_256_GCM_SHA384
* ALPN, server accepted to use http/1.1
* Server certificate:
*  subject: C=US; ST=California; L=Mountain View; O=Google LLC; CN=www.google.com
*  start date: Dec 20 13:13:44 2019 GMT
*  expire date: Mar 13 13:13:44 2020 GMT
*  subjectAltName: host "www.google.com" matched cert's "www.google.com"
*  issuer: C=US; O=Google Trust Services; CN=GTS CA 1O1
*  SSL certificate verify ok.
> HEAD / HTTP/1.1
> Host: www.google.com
> User-Agent: curl/7.67.0
> Accept: */*
>
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* TLSv1.3 (IN), TLS handshake, Newsession Ticket (4):
* old SSL session ID is stale, removing
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
HTTP/1.1 200 OK

@20NE
Copy link

20NE commented Jul 5, 2021

I'm using polipo to convert a sock5 proxy to http proxy. The socks5 proxy works fine as below

curl -v --socks5-hostname xx.xx.xx.xx:1080 https://www.google.com

But I got SOCKS protocol error when using http proxy from polipo.

1. start polipo
   polipo socksProxyType=socks5 socksParentProxy=xx.xx.xx.xx:1080 proxyAddress="0.0.0.0"

2. use the http proxy
   curl -v -x 127.0.0.1:8123 https://www.google.com
   ```
    * Rebuilt URL to: https://www.google.com/
    *   Trying 127.0.0.1...
    * TCP_NODELAY set
    * Connected to 127.0.0.1 (127.0.0.1) port 8123 (#0)
    * Establish HTTP proxy tunnel to www.google.com:443
    > CONNECT www.google.com:443 HTTP/1.1
    > Host: www.google.com:443
    > User-Agent: curl/7.54.0
    > Proxy-Connection: Keep-Alive
    > 
    < HTTP/1.1 504 Couldn't connect: SOCKS protocol error
    < Connection: close
    < Date: Thu, 18 Oct 2018 15:18:01 GMT
    < Content-Type: text/html
    < Content-Length: 475
    < Expires: 0
    < Cache-Control: no-cache
    < Pragma: no-cache
    < 
    * Received HTTP code 504 from proxy after CONNECT
    * Closing connection 0
    curl: (56) Received HTTP code 504 from proxy after CONNECT
   ```

same here, only when polipo use v2ray socks as socksparentproxy

@jech
Copy link
Owner

jech commented Jul 5, 2021

Polipo is no longer being maintained. Sorry.

@jech jech closed this as completed Jul 5, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants