cURL의 -b 및 -c 옵션은 무엇입니까?

cURL의 -b 및 -c 옵션은 무엇입니까?

cURL을 사용할 때 -b 및 -c 옵션은 무엇입니까? 맨컬에는 이런 설명이 있지만 나에게는 혼란스럽다. "-c, --cookie-jar", "-b, --cookie"라고 하면 둘 다 사용해야 한다는 의미인가요? 아니면 "--cookie jar"와 동일한 결과를 제공하는 "-c"를 사용할 수 있습니까? 그렇다면 동일한 작업을 수행하는 데 두 가지 다른 옵션이 있는 이유는 무엇입니까?

   -c, --cookie-jar <filename>
          (HTTP)  Specify  to  which  file you want curl to write all cookies after a
          completed operation. Curl writes all  cookies  from  its  in-memory  cookie
          storage  to  the  given  file  at  the end of operations. If no cookies are
          known, no data will be written. The file will be written using the Netscape
          cookie  file  format.  If  you set the file name to a single dash, "-", the
          cookies will be written to stdout.

          This command line option will activate the cookie engine  that  makes  curl
          record  and  use  cookies.  Another  way  to  activate it is to use the -b,
          --cookie option.

          If the cookie jar can't be created or written to, the whole curl  operation
          won't  fail or even report an error clearly. Using -v, --verbose will get a
          warning displayed, but that is the only visible feedback you get about this
          possibly lethal situation.

          If  this option is used several times, the last specified file name will be
          used.

   -b, --cookie <data|filename>
          (HTTP) Pass the data to the HTTP server in the Cookie header. It is suppos-
          edly  the data previously received from the server in a "Set-Cookie:" line.
          The data should be in the format "NAME1=VALUE1; NAME2=VALUE2".

          If no '=' symbol is used in the argument, it is instead treated as a  file-
          name  to read previously stored cookie from. This option also activates the
          cookie engine which will make curl record incoming cookies,  which  may  be
          handy if you're using this in combination with the -L, --location option or
          do multiple URL transfers on the same invoke. If the file name is exactly a
          minus ("-"), curl will instead the contents from stdin.

          The file format of the file to read cookies from should be plain HTTP head-
          ers (Set-Cookie style) or the Netscape/Mozilla cookie file format.

          The file specified with -b, --cookie is only used as input. No cookies will
          be  written to the file. To store cookies, use the -c, --cookie-jar option.

          Exercise caution if you are using this option and  multiple  transfers  may
          occur.   If  you  use  the  NAME1=VALUE1; format, or in a file use the Set-
          Cookie format and don't specify a domain, then the cookie is sent  for  any
          domain  (even  after  redirects  are  followed) and cannot be modified by a
          server-set cookie. If the cookie engine is enabled  and  a  server  sets  a
          cookie of the same name then both will be sent on a future transfer to that
          server, likely not what you intended.  To address these issues set a domain
          in  Set-Cookie  (doing  that  will include sub domains) or use the Netscape
          format.

          If this option is used several times, the last one will be used.

          Users very often want to both read cookies from a file  and  write  updated
          cookies  back to a file, so using both -b, --cookie and -c, --cookie-jar in
          the same command line is common.

답변1

-b 읽다파일(또는 축어적 문자열)의 쿠키를 요청에 포함하여 보냅니다.

-c 쓰다파일에 쿠키가 있는 경우(또는 이전에 사용한 파일에서 읽음 -b)

관련 정보