IT

괄호와 함께 URL을 전달하여 컬

lottoking 2020. 3. 22. 10:54
반응형

괄호와 함께 URL을 전달하여 컬


대괄호가 포함 된 curl에 URL을 전달하려고하면 오류와 함께 실패합니다.

$ curl 'http://www.google.com/?TEST[]=1'
curl: (3) [globbing] illegal character in range specification at pos 29

그러나 두 대괄호를 모두 벗어나면 작동하는 것처럼 보입니다.

$ curl 'http://www.google.com/?TEST\[\]=1'

흥미롭게도 백 슬래시를 사용하여 오류 코드 20497과 함께 자동으로 실패하는 첫 번째 브래킷 이스케이프 처리 합니다 .

$ curl 'http://www.google.com/?TEST\[]=1'
$ echo $!
20497

내 질문은 일반적인 경우 에이 문제를 해결하는 방법입니다. URL을 자동으로 이스케이프 처리하는 인수가 있거나 curl로 전달하기 전에 이스케이프해야하는 문자에 대한 설명이 있습니까?


신경 쓰지 마십시오. 문서에서 찾았습니다.

-g/--globoff
              This  option  switches  off  the "URL globbing parser". When you set this option, you can
              specify URLs that contain the letters {}[] without having them being interpreted by  curl
              itself.  Note  that  these  letters  are not normal legal URL contents but they should be
              encoded according to the URI standard.

참고 URL : https://stackoverflow.com/questions/8333920/passing-a-url-with-brackets-to-curl

반응형