2

パスワードで保護された http ドキュメントを投稿したいと考えています。
実際のドキュメントにアクセスする前に、ユーザー名とパスワードのログイン ページがあります。私はこれをやってみました

curl 
 -u username:password 
 "http://localhost:8983/solr/update/extract?literal.id=doc900&commit=true" 
 -F stream.url=http://somewebsite.com/docs/DOC2609

ただし、ログインページのみをインデックスに登録するだけです。

4

1 に答える 1

0

My guess is that the authentication method this page of yours uses is not one of the HTTP authentication methods that curl supports out-of-the-box.

The HTTP authentication is basic -- some might say trivial -- and it is fundamentally insecure in its most basic form (literally, 'basic' mode HTTP authentication sends the users' password over the wire in plain text, as one of the request headers). I only ever see it used in conjunction with HTTPS, and even that's pretty rare these days.

HTTP authentication is generally eschewed in favor of either an HTTP PUT or POST request over HTTPS, usually fortified with some kind of cross-site request forgery (CSRF) prevention measure, or an OAUTH2 strategy (which typically defers the issue to the authentication broker's implementation).

あなたの問題は、カールがこれについて何も知らないことです。Python でプログラミングする場合は、このrequestsパッケージが役立つ (そして起動するための設計が curl よりも新しい) ことに気付くかもしれません。HTTP API を適切に呼び出している場合、Solr はどちらの方法も気にしません。

于 2012-05-21T22:20:49.850 に答える