cURL / Mailing Lists / curl-users / Single Mail

curl-users

Re: question on "--request":can I remove the " /" after the request?

From: FUN TOES <funtest_at_operamail.com>
Date: Wed, 03 Mar 2004 02:48:55 +0100

Thank you very much to read my question so carefully though my english is so poor! Your curl give me help in manything without c programing(a bash script is enough) ,such
as autocheck and config the proxy?upload,etc.
And If curl can add every part of http(ftp,http,telnet,even ssl...)request or even reply to cmdline options and also give options to custom everyone of them,socket programing with c maybe be unnecesary to me.

> Thanks for the additional info. I think I understand your request a whole lot
> better now.
>
> Hm.
>
> I don't think you can trick curl into doing this without changing the source
> code.
>
> I wouldn't mind seeing curl support this (admittedly weird) setup. How would
> you prefer this to work from a user's point of view?
I am writing a script to autocheck the proxylist(second
proxy) and select the fastest one for my browser.
I found it give errors sometimes.But my program writen in c work well to these proxys.One of the difference is that
curl add " /" after the request "GET http://.../...".So I
have to let this work.If this is very difficult ,I have to
write every function in the script with c.
>
> For a quick patch to get it working, you can prevent curl to include the path
> the HTTP request, like you wanted. But that's not a viable option for the main
> sources! ;-)
>
>
> --
> Daniel Stenberg -- http://curl.haxx.se/ -- http://daniel.haxx.se/
> [[ Do not send mails to this email address. They won't reach me. ]]
>

I am not familiar with your code as you see.I do not know
why this is not a viable option. As my opionion ,the " /"
is part of the "GET" request,it should be controled by the
option "-X".Maybe I am wrong .Just as what I ask,I have little experience in programing.
 
Thanks for your help again! Now I make a local patch with
the http.c refered to by you to let curl work as my hope.
I do not use malloc to my temp ppath buffer ,unkown to the
position free was call after many return in the funciton Curl_http.

os:debian testing.
apt-get source curl
original:source version 7.11.0,with debian's 7.11.0-4 patch.
May it give no damage with the main code:
*** curl-7.11.0/lib/http.c 2004-01-12 06:17:58.000000000 +0800
--- curl-7.11.0-customrequest/lib/http.c 2004-03-03 21:37:23.000000000 +0800
***************
*** 1055,1061 ****
    char *request;
    bool authdone=TRUE; /* if the authentication phase is done */
    Curl_HttpReq httpreq; /* type of HTTP request */
!
    if(!conn->proto.http) {
      /* Only allocate this struct if we don't already have it! */

--- 1055,1066 ----
    char *request;
    bool authdone=TRUE; /* if the authentication phase is done */
    Curl_HttpReq httpreq; /* type of HTTP request */
! int size1 = strlen(ppath)+sizeof(' ')+1;
! int size2 = strlen(data->change.url)+sizeof(' ')+1;
! char ppath_new[size1>size2?size1:size2];
! /*not familiar with curl's malloc admin and the usage of conn->ppath
! out of this func */
!
    if(!conn->proto.http) {
      /* Only allocate this struct if we don't already have it! */
  
***************
*** 1330,1340 ****
      if(!req_buffer)
        return CURLE_OUT_OF_MEMORY;
      
      /* add the main request stuff */
      result =
        add_bufferf(req_buffer,
! "%s " /* GET/HEAD/POST/PUT */
! "%s HTTP/%s\r\n" /* path + HTTP version */
                    "%s" /* proxyuserpwd */
                    "%s" /* userpwd */
                    "%s" /* range */
--- 1335,1354 ----
      if(!req_buffer)
        return CURLE_OUT_OF_MEMORY;
 
+ /****select ppath*****/
+ if(data->set.customrequest){
+ ppath_new[0] = '\x0';
+ }else{
+ memset(ppath_new,0,sizeof(ppath_new));
+ ppath_new[0] = ' ';
+ memmove(ppath_new+1,ppath,strlen(ppath));
+ }
+
      /* add the main request stuff */
      result =
        add_bufferf(req_buffer,
! "%s%s" /* GET/HEAD/POST/PUT */
! " HTTP/%s\r\n" /* path + HTTP version */
                    "%s" /* proxyuserpwd */
                    "%s" /* userpwd */
                    "%s" /* range */
***************
*** 1348,1354 ****
                    "%s",/* transfer-encoding */

                   request,
! ppath,
                  httpstring,
                  (conn->bits.httpproxy && conn->allocptr.proxyuserpwd)?
                  conn->allocptr.proxyuserpwd:"",
--- 1362,1368 ----
                    "%s",/* transfer-encoding */
                  
                  request,
! ppath_new,
                  httpstring,
                  (conn->bits.httpproxy && conn->allocptr.proxyuserpwd)?
                  conn->allocptr.proxyuserpwd:"",

-- 
_____________________________________________________________
Web-based SMS services available at http://www.operamail.com.
>From your mailbox to local or overseas cell phones.
Powered by Outblaze
Received on 2004-03-03