Windows 및 Mac OS X에서 모두 컬을 사용하여 시도했으며 항상 동일한 결과를 산출합니다. 나는 영역에 대한 요청을 시작하고 난 인증 할 --digest
플래그를 사용하고 있습니다 :curl은 항상 두 개의 헤더를 반환합니다.
curl <options> --digest --user admin <endpoint> -v -v --raw
내 전화의 모든 두 개의 헤더 결과 :
* Adding handle: conn: 0x7f908c80ba00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f908c80ba00) send_pipe: 1, recv_pipe: 0
* About to connect() to localhost port 8002 (#0)
* Trying ::1...
* Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8002 (#0)
* Server auth using Digest with user 'admin'
> PUT /endpoint HTTP/1.1
> User-Agent: curl/7.30.0
> Host: localhost:8002
> Accept: */*
> Content-type: application/xml
> Content-Length: 0
>
< HTTP/1.1 401 Unauthorized
< WWW-Authenticate: Digest realm="public", qop="auth", nonce="e54fba22d0eca67e26155cf243dcf4ca", opaque="370985129eb9e9d5"
< Content-type: application/xml
* Server <X> is not blacklisted
< Server: <X>
< Content-Length: 173
< Connection: Keep-Alive
< Keep-Alive: timeout=5
<
* Ignoring the response-body
* Connection #0 to host localhost left intact
* Issue another request to this URL: 'http://localhost:8002/endpoint'
* Found bundle for host localhost: 0x7f908b6095c0
* Re-using existing connection! (#0) with host localhost
* Connected to localhost (127.0.0.1) port 8002 (#0)
* Adding handle: conn: 0x7f908c80ba00
* Adding handle: send: 0
* Adding handle: recv: 0
* Curl_addHandleToPipeline: length: 1
* - Conn 0 (0x7f908c80ba00) send_pipe: 1, recv_pipe: 0
* Server auth using Digest with user 'admin'
> PUT /endpoint HTTP/1.1
> Authorization: Digest username="admin", realm="public", nonce="e54fba22d0eca67e26155cf243dcf4ca", uri="/endpoint", cnonce="ICAgICAgICAgICAgICAgICAgICAgIDEzOTc5NzM3MzY=", nc=00000001, qop=auth, response="47da275c9b69e8541ed335a040d4d10d", opaque="370985129eb9e9d5"
> User-Agent: curl/7.30.0
> Host: localhost:8002
> Accept: */*
> Content-type: application/xml
> Content-Length: 118
>
* upload completely sent off: 118 out of 118 bytes
< HTTP/1.1 204 No Content
* Server <X> is not blacklisted
< Server: <X>
< Content-Length: 0
< Connection: Keep-Alive
< Keep-Alive: timeout=5
<
* Connection #0 to host localhost left intact
왜 난 항상 401을받을 수 있나요 머리글? --anyauth
플래그로 표시되지만 --digest
플래그로는 표시되지 않습니다.
당신의 로그에 PUT 요청을하고있는'PUT/endpoint'라고 쓰여 있습니다. 하지만 콘텐츠 길이는 0입니다. 'Content-Length : 0'. 그러니 질문에서 정확한 컬 명령을 편집하고 업로드하십시오. –
내용이 있건 없건 동일합니다 – Tamas