Coder Social home page Coder Social logo

Can not work proxy auth about curl HOT 10 CLOSED

libetl avatar libetl commented on June 8, 2024
Can not work proxy auth

from curl.

Comments (10)

libetl avatar libetl commented on June 8, 2024

I need to find a sample proxy server that requires authentication. Do you have one that is available publicly ?

from curl.

libetl avatar libetl commented on June 8, 2024

maybe that one : https://github.com/liggitt/auth-proxy

from curl.

libetl avatar libetl commented on June 8, 2024

quite stupid mistake in the code.
I wrote Proxy-Authenticate (which is a response header) instead of Proxy-Authorization.

I will patch right away.

from curl.

libetl avatar libetl commented on June 8, 2024

Thanks for the notice.

from curl.

libetl avatar libetl commented on June 8, 2024

Tested locally, cannot write an unit test unfortunately.

from curl.

libetl avatar libetl commented on June 8, 2024

pushing 0.0.18

from curl.

shige0102 avatar shige0102 commented on June 8, 2024

Hi

Thanks for the response and the patch .
I retired the new source.
HTTP proxy is it work. But HTTPS proxy is not work.
In HTTPS, the header set in HttpRequestBase.setConfig is not set to the proxy.
set the Proxy-Authorization with setDefaultHeaders.

It does not work when setting authentication information with the -x option.

-x http://user:password@proxyserver:8080 https://www.google.com
Caused by: java.util.concurrent.ExecutionException: org.toilelibre.libe.curl.Curl$CurlException: java.net.UnknownHostException: user:password@proxyserver
at java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:357)
at java.util.concurrent.CompletableFuture.get(CompletableFuture.java:1895)
at org.toilelibre.libe.curl.Curl.curl(Curl.java:35)

from curl.

libetl avatar libetl commented on June 8, 2024

new unit tests :

    @Test
    public void proxyWithAuthentication2 () {
        //given
        CommandLine commandLine = ReadArguments.getCommandLineFromRequest (
                "-x http://localhost:80/ -U jack:insecure http://www.google.com/");

        //when
        HttpUriRequest request = HttpRequestProvider.prepareRequest (commandLine);

        //then
        assertEquals (request.getFirstHeader ("Proxy-Authorization").getValue (),
                "Basic amFjazppbnNlY3VyZQ==");
        assertEquals(((HttpGet)request).getConfig().getProxy().toString(), "http://localhost:80");
    }

    @Test
    public void proxyWithAuthentication3 () {
        //given
        CommandLine commandLine = ReadArguments.getCommandLineFromRequest (
                "-x http://jack:insecure@localhost:80/ http://www.google.com/");

        //when
        HttpUriRequest request = HttpRequestProvider.prepareRequest (commandLine);

        //then
        assertEquals (request.getFirstHeader ("Proxy-Authorization").getValue (),
                "Basic amFjazppbnNlY3VyZQ==");
        assertEquals(((HttpGet)request).getConfig().getProxy().toString(), "http://localhost:80");
    }

from curl.

libetl avatar libetl commented on June 8, 2024

I did not work with https proxies yet.

But it will work with the http://user:password@hostname from the version 0.0.19

from curl.

libetl avatar libetl commented on June 8, 2024

closing since no activity in the feed for one week.
Please reopen in case where you are not satisfied with the assistance.

from curl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.