Can anyone tell me how can i use "HttpAddUrl" ?

When I use it like follow:

retCode = HttpAddUrl(
hReqQueue, // Req Queue
"http://127.0.0.1:80/",
NULL // Reserved
);
after it runs,I got a error 87 which is ERROR_INVALID_PARAMETER:The parameter is incorrect.,can anyone tell me how can i use it properly,besides,the function's prototype is :

ULONG HttpAddUrl(
 HANDLE ReqQueueHandle,
 PCWSTR pUrlPrefix,
 PVOID pReserved
);

1000 billions thanks~

small_snap : )




Answer this question

Can anyone tell me how can i use "HttpAddUrl" ?

  • BruceJohnson

     

    The PCWSTR pUrlPrefix parameter requires a unicode string. You can create one with an L in front of the string.
    This should work :

     retCode = HttpAddUrl(
                        hReqQueue,    // Req Queue
                        L"
    http://127.0.0.1:80/",
                          NULL          // Reserved
                        );

    Btw, according to documentation this function is obsolete.


  • YohanAudoux

    Hello,

    Your address 192.168.2.109 is a local address, so I suppose you're accessing the Internet through a small router.

    I also suppose the other computer from wich you are trying to connect is connected to the Internet through another way, so it has to use the public address of your router and not the local address of your computer.

    If this is true, the problem is a problem of router configuration and not of programming. You'll have to :

    1) configure you router to redirect incoming messages on port 39686 to your computer 192.168.2.109 ;

    2) find the Internet address of your router ;

    3) use this address in place of 192.168.2.109 in the browser of the other computer.


  • jporto

    hello,thank you very much for your reply,I do exact way what you've told ,now my code is as follow:

    retCode = HttpAddUrl(
    hReqQueue, // Req Queue
    L"http://192.168.2.109:39686/test/hh",//it's my IP address
    NULL // Reserved
    );

    my IP address is 192.168.2.109,if I run the program ,then type "http://192.168.2.109:39686/test/hh" in my browser,I can receive the http GET request now,but with another computer ,it's still don't work ,I don't know why.....

    small_snap

    10000 billions thanks
    : )



  • flyonthewall

    AFAIK You have to use an URL not an IP address!

  • Can anyone tell me how can i use "HttpAddUrl" ?