This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler/TIDM-TM4C129XGATEWAY: How to set the proxy server

Part Number: TIDM-TM4C129XGATEWAY

Tool/software: TI C/C++ Compiler

Hi,

Currently i am able to send GET and POST request on my target server. I am working on setting the proxy server.

Here is what I have done so far.

1. Made up a proxy server that is working ok if we setup the proxy setting in internet option and access the target server from a web browser

2.  set up the proxy server as

       // these lines are called at start of my ethernet task.

        struct sockaddr_in paddr;
        paddr.sin_family = AF_INET;
        paddr.sin_port = htons(80); // proxy server is using port 80
        paddr.sin_addr.s_addr = sl_Htonl(SL_IPV4_VAL(a,b,c,d));// for proxy server ip = a.b.c.d    
        HTTPCli_setProxy((struct sockaddr *)&paddr);

I hoped it would do the work. But it is failing at httpProxyTunnel function. i.e.

at line


    host = getRequestFieldValue(cli, HTTPStd_FIELD_NAME_HOST);

it gets a null.

I added the host and fixed this issue. Now it is stuck in following line of "httpProxyTunnel" function


    ret = getStatus(cli); // inside this function at below line
            status = skipLine(cli); // inside this function it never gets the newline or '\n'

while (c != '\n') { // stuck in this loop.

it will be very helpful if someone can help and guide what is going on wrong here. Thanks,

  • Hi,

      I want to make sure that you are using TI-RTOS NDK. Is this correct? If yes, I will forward your post to our NDK experts. 

  • Yes, I am using TI-RTOS NDK.
    Thank,

  • Hamza,

    I would like to confirm your test topology. Are you using the TM4C as an HTTP Client? And you want this client to use a proxy server to access an external web server? Have I got this correct?

    If so, it seems client has received a response which does not contain the expected data. Would you attach a Wireshark trace of the network traffic between the TM4C client and the proxy server. Then we can inspect the packet and see what the data looks like.

    Also, would you confirm which version of the SDK you are using.

    Thank you,
    ~Ramsey

  • Hi Ramsey,

    Yes, I am using TM4C as an HTTP client and wanted to access the external web server through proxy server. I did run the Wireshark trace and fixed the issue. Now I am able to run the my data through the proxy server.


    Here are few mistakes that I was doing: 


    1. In function httpProxyTunnel(HTTPCli_Handle cli), set the host to "web server url/ip : port (used in web server communication)"

    2. While setting the proxy server, dont forget to type cast the SL_IPV4_VAL function with (_u32)

    paddr.sin_addr.s_addr = sl_Htonl((_u32) SL_IPV4_VAL(a,b,c,d));  // here the ip of proxy server is a.b.c.d

    3. In my code, I connect the socket with my server to test and then again while sending the data. But when I was trying this behavior with the proxy server, I was not able to connect again while sending data. This seems to be not sending the data. So I skipped the connecting socket for testing and just used it for connect and send data. It worked. 

    Also I am here for any such question regarding setting up the proxy server. :)
    Thanks,
    Hamza

  • Hamza,

    Great to hear you have it working. And thank you for sharing your results with the community. Very much appreciated.

    ~Ramsey