cURL
cURLμ 리λ μ€μ λ§₯ ν°λ―Έλμμ HTTP μμ²μ μνν΄λ³΄κΈ° μν΄μ λ§μ΄ μ¬μ©λλ€. μλμ°μμλ λ§μ΄ν¬λ‘μννΈμμ μ 곡νλ 컬 νλ‘κ·Έλ¨μ΄ λ΄μ₯λμ΄μλ€. κ·Έλμ λͺ λ Ή ν둬ννΈ(cmd)λ‘ curl λͺ λ Ήμ΄λ₯Ό μνν΄λ³΄λ©΄ μλμ κ°μ΄ μ μμ μΌλ‘ μ¬μ©ν μ μμμ μ μ μλ€. νμ§λ§, μλμ° ν°λ―Έλμμλ λͺ λ Ή ν둬ννΈκ° μλλΌ νμμ(Powershll)μ μ¬μ©νκ³ μμΌλ―λ‘ Invoke-WebRequest μΌλ‘ νΈμΆλμ΄ κΈ°λ³Έμ μΌλ‘ μλ λͺ λ Ήμ΄κ° μνλμ§ μλλ€.
C:\Users\Mambo>curl -V
curl 8.0.1 (Windows) libcurl/8.0.1 Schannel WinIDN
Release-Date: 2023-03-20
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets
PS C:\Users\Mambo> curl
cmdlet Invoke-WebRequest(λͺ
λ Ή νμ΄νλΌμΈ μμΉ 1)
λ€μ λ§€κ° λ³μμ λν κ°μ μ 곡νμμμ€.
Uri: okky.kr
StatusCode : 200
StatusDescription : OK
Content : <!DOCTYPE html><html lang="ko" class="js-focus-visible h-full"><head><meta charSet="utf-8"/><title>
OKKY - All That Developer</title><meta name="robots" content="index,follow"/><meta name="descriptio
n"...
RawContent : HTTP/1.1 200 OK
Transfer-Encoding: chunked
Connection: keep-alive
Vary: Accept-Encoding
Cache-Control: private, no-cache, no-store, max-age=0, must-revalidate
Content-Type: text/html; charset=utf...
Forms : {}
Headers : {[Transfer-Encoding, chunked], [Connection, keep-alive], [Vary, Accept-Encoding], [Cache-Control, p
rivate, no-cache, no-store, max-age=0, must-revalidate]...}
Images : {}
InputFields : {}
Links : {}
ParsedHtml : mshtml.HTMLDocumentClass
RawContentLength : 22832
cURLμ curl shipped by Microsoft λ¬Έμλ₯Ό μ°Έκ³ ν΄λ³΄λ©΄ Powershell Aliasμ λν λ¬Έμ λ‘ μΈν΄ curl.exe λ‘ νλ‘κ·Έλ¨μ μ§μ νμ¬ λͺ λ Ήμ΄λ₯Ό μννλλ‘ μλ΄νλ€.
PS C:\Users\Mambo> curl.exe -V
curl 8.0.1 (Windows) libcurl/8.0.1 Schannel WinIDN
Release-Date: 2023-03-20
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets
νμμ Alias μ κ±°νκΈ°
Remove-Item λͺ λ Ήμ΄λ‘ Aliasλ₯Ό μ κ±°ν μ μμΌλ©° λͺ λ Ήμ΄λ₯Ό μ€ννκ³ λμ μνλ₯Ό μ μ§ν μ μλλ‘ νμ¬ νλ‘νμΌμ λ©λͺ¨μ₯μΌλ‘ μ΄μ΄ curlμ λν Aliasλ₯Ό μμ ν μ μλλ‘ μ½λλ₯Ό μμ±νμ¬ μ μ₯νλλ‘ νμ. μ΄μ λ κ΅³μ΄ curl.exe λΌλ νλ‘κ·Έλ¨μ μ§μ ν΄μ νΈμΆν νμκ° μμ΄μ§λ€.
PS C:\Users\Mambo> remove-item alias:\curl
PS C:\Users\Mambo> curl -V
curl 8.0.1 (Windows) libcurl/8.0.1 Schannel WinIDN
Release-Date: 2023-03-20
Protocols: dict file ftp ftps http https imap imaps pop3 pop3s smtp smtps telnet tftp
Features: AsynchDNS HSTS HTTPS-proxy IDN IPv6 Kerberos Largefile NTLM SPNEGO SSL SSPI threadsafe Unicode UnixSockets
notepad $profile
# λ©λͺ¨μ₯ μλ¨μ μ
λ ₯
if (Test-Path -Path alias:curl) { Remove-Item alias:curl }
[ν] 리λ μ€μμ cURL λͺ λ Ήμ΄ μΆλ ₯μ΄ κ°νλμ§ μμ κ²½μ°
κ°νΉ 리λ μ€μμ cURL λͺ λ Ήμ΄λ₯Ό μννλ©΄ μΆλ ₯ κ²°κ³Όκ° κ°νλμ§ μμμ λ€μ λͺ λ Ήμ΄λ₯Ό νΈμΆν λ λΆνΈν¨μ λλ μ μλ€. https://stackoverflow.com/a/14614203μ λμμλ κ²μ²λΌ μ¬μ©μ λλ ν 리μ .curlrc νμΌμ λ§λ€μ΄μ κ°νμ΄ λμνλλ‘ μμ±ν΄λλ©΄ λλ€.
vi ~/.curlrc
-w "\n"