some webdav plumbing and light tidying; bug 212342; r=darin,sr=bzbarsky

This commit is contained in:
shaver%mozilla.org 2004-10-15 05:59:21 +00:00
Родитель 507e01d04e
Коммит 0fd1bdf643
3 изменённых файлов: 50 добавлений и 31 удалений

Просмотреть файл

@ -38,16 +38,16 @@
/******
This file contains the list of all HTTP atoms
See nsHttp.h for access to the atoms
See nsHttp.h for access to the atoms.
It is designed to be used as inline input to nsHttp.cpp *only*
through the magic of C preprocessing.
All entires must be enclosed in the macro HTTP_ATOM which will have cruel
and unusual things done to it
All entries must be enclosed in the macro HTTP_ATOM which will have cruel
and unusual things done to it.
The first argument to HTTP_ATOM is the C++ name of the atom
The second argument it HTTP_ATOM is the string value of the atom
The first argument to HTTP_ATOM is the C++ name of the atom.
The second argument to HTTP_ATOM is the string value of the atom.
******/
HTTP_ATOM(Accept, "Accept")
@ -70,14 +70,19 @@ HTTP_ATOM(Content_MD5, "Content-MD5")
HTTP_ATOM(Content_Range, "Content-Range")
HTTP_ATOM(Content_Transfer_Encoding, "Content-Transfer-Encoding")
HTTP_ATOM(Content_Type, "Content-Type")
HTTP_ATOM(Cookie, "Cookie")
HTTP_ATOM(Date, "Date")
HTTP_ATOM(DAV, "DAV")
HTTP_ATOM(Depth, "Depth")
HTTP_ATOM(Derived_From, "Derived-From")
HTTP_ATOM(Destination, "Destination")
HTTP_ATOM(ETag, "Etag")
HTTP_ATOM(Expect, "Expect")
HTTP_ATOM(Expires, "Expires")
HTTP_ATOM(From, "From")
HTTP_ATOM(Forwarded, "Forwarded")
HTTP_ATOM(From, "From")
HTTP_ATOM(Host, "Host")
HTTP_ATOM(If, "If")
HTTP_ATOM(If_Match, "If-Match")
HTTP_ATOM(If_Match_Any, "If-Match-Any")
HTTP_ATOM(If_Modified_Since, "If-Modified-Since")
@ -87,13 +92,14 @@ HTTP_ATOM(If_Range, "If-Range")
HTTP_ATOM(If_Unmodified_Since, "If-Unmodified-Since")
HTTP_ATOM(Keep_Alive, "Keep-Alive")
HTTP_ATOM(Last_Modified, "Last-Modified")
HTTP_ATOM(Lock_Token, "Lock-Token")
HTTP_ATOM(Link, "Link")
HTTP_ATOM(Location, "Location")
HTTP_ATOM(Max_Forwards, "Max-Forwards")
HTTP_ATOM(Message_Id, "Message-Id")
HTTP_ATOM(Mime, "Mime")
HTTP_ATOM(Overwrite, "Overwrite")
HTTP_ATOM(Pragma, "Pragma")
HTTP_ATOM(Vary, "Vary")
HTTP_ATOM(Proxy_Authenticate, "Proxy-Authenticate")
HTTP_ATOM(Proxy_Authorization, "Proxy-Authorization")
HTTP_ATOM(Proxy_Connection, "Proxy-Connection")
@ -101,18 +107,21 @@ HTTP_ATOM(Range, "Range")
HTTP_ATOM(Referer, "Referer")
HTTP_ATOM(Retry_After, "Retry-After")
HTTP_ATOM(Server, "Server")
HTTP_ATOM(Set_Cookie, "Set-Cookie")
HTTP_ATOM(Set_Cookie2, "Set-Cookie2")
HTTP_ATOM(Status_URI, "Status-URI")
HTTP_ATOM(TE, "TE")
HTTP_ATOM(Title, "Title")
HTTP_ATOM(Timeout, "Timeout")
HTTP_ATOM(Trailer, "Trailer")
HTTP_ATOM(Transfer_Encoding, "Transfer-Encoding")
HTTP_ATOM(Upgrade, "Upgrade")
HTTP_ATOM(URI, "URI")
HTTP_ATOM(Upgrade, "Upgrade")
HTTP_ATOM(User_Agent, "User-Agent")
HTTP_ATOM(Vary, "Vary")
HTTP_ATOM(Version, "Version")
HTTP_ATOM(Warning, "Warning")
HTTP_ATOM(WWW_Authenticate, "WWW-Authenticate")
HTTP_ATOM(Set_Cookie, "Set-Cookie")
HTTP_ATOM(Cookie, "Cookie")
HTTP_ATOM(Warning, "Warning")
// methods are atoms too.
//
@ -120,13 +129,20 @@ HTTP_ATOM(Cookie, "Cookie")
// just keep the methods mixedcase even though they're normally written all
// uppercase -- darin
HTTP_ATOM(Options, "OPTIONS")
HTTP_ATOM(Head, "HEAD")
HTTP_ATOM(Post, "POST")
HTTP_ATOM(Put, "PUT")
HTTP_ATOM(Get, "GET")
HTTP_ATOM(Index, "INDEX")
HTTP_ATOM(Delete, "DELETE")
HTTP_ATOM(Trace, "TRACE")
HTTP_ATOM(Connect, "CONNECT")
HTTP_ATOM(Copy, "COPY")
HTTP_ATOM(Delete, "DELETE")
HTTP_ATOM(Get, "GET")
HTTP_ATOM(Head, "HEAD")
HTTP_ATOM(Index, "INDEX")
HTTP_ATOM(Lock, "LOCK")
HTTP_ATOM(M_Post, "M-POST")
HTTP_ATOM(Mkcol, "MKCOL")
HTTP_ATOM(Move, "MOVE")
HTTP_ATOM(Options, "OPTIONS")
HTTP_ATOM(Post, "POST")
HTTP_ATOM(Propfind, "PROPFIND")
HTTP_ATOM(Proppatch, "PROPPATCH")
HTTP_ATOM(Put, "PUT")
HTTP_ATOM(Trace, "TRACE")
HTTP_ATOM(Unlock, "UNLOCK")

Просмотреть файл

@ -465,7 +465,9 @@ nsHttpChannel::SetupTransaction()
//
if (!mAllowPipelining || (mLoadFlags & LOAD_INITIAL_DOCUMENT_URI) ||
!(mRequestHead.Method() == nsHttp::Get ||
mRequestHead.Method() == nsHttp::Head)) {
mRequestHead.Method() == nsHttp::Head ||
mRequestHead.Method() == nsHttp::Propfind ||
mRequestHead.Method() == nsHttp::Proppatch)) {
LOG((" pipelining disallowed\n"));
mCaps &= ~NS_HTTP_ALLOW_PIPELINING;
}
@ -1224,14 +1226,13 @@ nsHttpChannel::OpenCacheEntry(PRBool offline, PRBool *delayed)
nsresult
nsHttpChannel::GenerateCacheKey(nsACString &cacheKey)
{
cacheKey.SetLength(0);
if (mPostID) {
char buf[32];
PR_snprintf(buf, sizeof(buf), "%x", mPostID);
cacheKey.Append("id=");
cacheKey.Append(buf);
cacheKey.Append("&uri=");
}
PR_snprintf(buf, sizeof(buf), "id=%x&uri=", mPostID);
cacheKey.Assign(buf);
} else
cacheKey.Truncate();
// Strip any trailing #ref from the URL before using it as the key
const char *spec = mSpec.get();
const char *p = strchr(spec, '#');
@ -2413,9 +2414,11 @@ nsHttpChannel::PromptForIdentity(const char *scheme,
GetCallback(NS_GET_IID(nsIAuthPromptProvider), getter_AddRefs(authPromptProvider));
if (authPromptProvider) {
PRUint32 promptReason = (proxyAuth ?
nsIAuthPromptProvider::PROMPT_PROXY :
nsIAuthPromptProvider::PROMPT_NORMAL);
PRUint32 promptReason;
if (proxyAuth)
promptReason = nsIAuthPromptProvider::PROMPT_PROXY;
else
promptReason = nsIAuthPromptProvider::PROMPT_NORMAL;
(void) authPromptProvider->GetAuthPrompt(promptReason, getter_AddRefs(authPrompt));
}
else

Просмотреть файл

@ -522,7 +522,7 @@ nsHttpTransaction::Close(nsresult reason)
NS_RELEASE(mConnection);
mStatus = reason;
mTransactionDone = PR_TRUE; // force this flag
mTransactionDone = PR_TRUE; // forcibly flag the transaction as complete
mClosed = PR_TRUE;
// release some resources that we no longer need
@ -534,7 +534,7 @@ nsHttpTransaction::Close(nsresult reason)
mChunkedDecoder = nsnull;
}
// closing this pipe signals triggers the channel's OnStopRequest method.
// closing this pipe triggers the channel's OnStopRequest method.
mPipeOut->CloseWithStatus(reason);
}