1 // Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
18 @warning : This file contains Rose Model ID comments - please do not delete
27 //##ModelId=3C4C18750141
30 The complete set of HTTP Status codes, as defined in RFC2616.
38 /** 'Informational' range of codes 1xx
43 /** Switching Protocols.
45 ESwitchingProtocols = 101,
46 /** 'Successful' range of codes 2xx
54 /** The entry has been accepted.
57 /** Non-Authoritative Information.
59 ENonAuthoritativeInfo = 203,
68 EPartialContent = 206,
69 /** 'Redirection' range of codes 3xx
73 EMultipleChoices = 300,
74 /** Moved Permanently.
76 EMovedPermanently = 301,
78 Note, this is deprecated in HTTP/1.1 - 307 will be used instead
93 /** Temporary Redirect.
95 ETemporaryRedirect = 307,
96 /** 'Client Error' range of codes 4xx
104 /** Payment Required. Note, this is reserved in HTTP/1.1
106 EPaymentRequired = 402,
113 /** Method Not Allowed.
115 EMethodNotAllowed = 405,
118 ENotAcceptable = 406,
119 /** Proxy Authentication Required.
121 EProxyAuthenticationRequired = 407,
124 ERequestTimeout = 408,
133 ELengthRequired = 411,
134 /** Precondition Failed.
136 EPreconditionFailed = 412,
137 /** Request Entity Too Large.
139 ERequestEntityTooLarge = 413,
140 /** Request-URI Too Long.
142 ERequestURITooLong = 414,
143 /** Unsupported Media Type.
145 EUnsupportedMediaType = 415,
146 /** Requested Range Not Satisfiable.
148 ERequestedRangeNotSatisfiable = 416,
149 /** Expectation Failed.
151 EExpectationFailed = 417,
152 /** 'Server Error' range of codes 5xx
154 /** Internal Server Error.
156 EInternalServerError = 500,
159 ENotImplemented = 501,
163 /** Service Unavailable.
165 EServiceUnavailable = 503,
168 EGatewayTimeout = 504,
169 /** HTTP Version Not Supported.
171 EHTTPVersionNotSupported = 505
174 /** Is the supplied status code in the 1xx Informational range?
175 @param aStatus Is the supplied status code in the 1xx Informational range?
176 @return ETrue if the specified status code is in the 1xx Informational range.
177 ##ModelId=3C4C18750162
179 inline static TBool IsInformational(TInt aStatus);
182 /** Is the supplied status code in the 2xx Successful range?
183 @param aStatus Is the supplied status code in the 2xx Successful range?
184 @return ETrue if the specified status code is in the 2xx Successful range
185 ##ModelId=3C4C18750160
187 inline static TBool IsSuccessful(TInt aStatus);
189 /** Is the supplied status code in the 3xx Redirection range?
190 @param aStatus Is the supplied status code in the 3xx Redirection range?
191 @return ETrue if the specified status code is in the 3xx Redirection range.
192 ##ModelId=3C4C18750159
194 inline static TBool IsRedirection(TInt aStatus);
196 /** Is the supplied status code in the 4xx Client Error range?
197 @param aStatus Is the supplied status code in the 4xx Client Error range?
198 @return ETrue if the specified status code is in the 4xx Client Error range.
199 ##ModelId=3C4C18750157
201 inline static TBool IsClientError(TInt aStatus);
203 /** Is the supplied status code in the 5xx Server Error range?
204 @param aStatus Is the supplied status code in the 5xx Server Error range?
205 @return ETrue if the specified status code is in the 5xx Server Error range.
206 ##ModelId=3C4C18750155
208 inline static TBool IsServerError(TInt aStatus);
217 // HTTPPanic::Panic(HTTPPanic:: )
219 //##ModelId=3C4C18740352
230 /** RHTTPSession session is already open. ( Panic HTTP-CORE 0 )
233 /** Specified field is missing. ( Panic HTTP-CORE 1 )
236 /** Unused. ( Panic HTTP-CORE 2 )
239 /** Unused. ( Panic HTTP-CORE 3 )
242 /** Mismatch between header's type and its attempted use. ( Panic HTTP-CORE 4 )
245 /** Unused. ( Panic HTTP-CORE 5 )
247 ETransactionEventOutstanding,
248 /** A transaction error occurred, and the MHFRunError() in use didn't handle it. ( Panic HTTP-CORE 6 )
250 ETransactionUnhandledError,
251 /** Attempted to add a filter while there is a transaction outstanding. ( Panic HTTP-CORE 7 )
253 EAddingFilterWithOutstandingTransactions,
254 /** Attempted to add a filter at a position not between the protocol handler and the client. ( Panic HTTP-CORE 8 )
256 EFilterInvalidPosition,
257 /** CHTTPEncoder object destroyed without its data being released. ( Panic HTTP-CORE 9 )
259 EHTTPFormDataUnreleased,
260 /** CHTTPEncoder object at the wrong state for adding data. ( Panic HTTP-CORE 10 )
262 EHTTPFormSupplyingData,
263 /** Unused. ( Panic HTTP-CORE 11 )
265 EValidationFilterFailure,
266 /** Invalid request data. ( Panic HTTP-CORE 12 )
269 /** Invalid response data. ( Panic HTTP-CORE 13 )
272 /** Unused. ( Panic HTTP-CORE 14 )
274 ENoTransportHandlerSet,
275 /** Unused. ( Panic HTTP-CORE 15 )
277 EAuthenticationFilterBadState,
278 /** An invalid filter handle was specified. ( Panic HTTP-CORE 16 )
280 EInvalidFilterHandle,
281 /** An invalid event ( Panic HTTP-CORE 17 )
286 //##ModelId=3C4C18740366
287 static void Panic(THTTPPanic aPanic);
290 // HTTP external errors/leave codes. Add new sub-ranges at the end; do not insert between the sub-ranges that
291 // are already here. This is to allow a client to reasonably check for errors between two adjacent range
292 // base values rather than check for individual codes.
295 Base value for the HTTP error code range (-7200 to -7399)
299 const TInt KHttpErrorBase = -7200;
302 // Text mode HTTP protocol handler
306 Codec encoding errors for HTTP headers
310 const TInt KHttpHeaderEncodeErrorBase = KHttpErrorBase;
313 Error making a default encoding of unrecognised headers
317 const TInt KErrHttpEncodeDefault = KHttpHeaderEncodeErrorBase;
319 Error encoding the Accept field
323 const TInt KErrHttpEncodeAccept = KHttpHeaderEncodeErrorBase - 1;
325 Error encoding the Accept-Charset field
329 const TInt KErrHttpEncodeAcceptCharset = KHttpHeaderEncodeErrorBase - 2;
331 Error encoding a q-value parameter
335 const TInt KErrHttpEncodeQValue = KHttpHeaderEncodeErrorBase - 3;
337 Error encoding the Authorization field
341 const TInt KErrHttpEncodeAuthorization = KHttpHeaderEncodeErrorBase - 4;
343 Error encoding Basic credentials
347 const TInt KErrHttpEncodeBasicAuth = KHttpHeaderEncodeErrorBase - 5;
349 Error encoding Digest credentials
353 const TInt KErrHttpEncodeDigestAuth = KHttpHeaderEncodeErrorBase - 6;
355 Error encoding the Connection field
359 const TInt KErrHttpEncodeConnection = KHttpHeaderEncodeErrorBase - 7;
361 Error encoding the Content-Length field
365 const TInt KErrHttpEncodeContentLength = KHttpHeaderEncodeErrorBase - 8;
367 Error encoding the Content-Type field
371 const TInt KErrHttpEncodeContentType = KHttpHeaderEncodeErrorBase - 9;
373 Error encoding the Host field
377 const TInt KErrHttpEncodeHost = KHttpHeaderEncodeErrorBase - 10;
379 Error encoding the Host field's port parameter
383 const TInt KErrHttpEncodeHostPort = KHttpHeaderEncodeErrorBase - 11;
385 Error encoding the Transfer-Encoding field
389 const TInt KErrHttpEncodeTransferEncoding = KHttpHeaderEncodeErrorBase - 12;
391 Error encoding the User-Agent field
395 const TInt KErrHttpEncodeUserAgent = KHttpHeaderEncodeErrorBase - 13;
397 Error encoding the Date field
401 const TInt KErrHttpEncodeDate = KHttpHeaderEncodeErrorBase - 14;
403 Error encoding the Cookie field
407 const TInt KErrHttpEncodeCookie = KHttpHeaderEncodeErrorBase - 15;
409 Error encoding the Cache-Control field
413 const TInt KErrHttpEncodeCacheControl = KHttpHeaderEncodeErrorBase - 16;
415 Error encoding the Pragma field
419 const TInt KErrHttpEncodePragma = KHttpHeaderEncodeErrorBase - 17;
421 Error encoding the if match field
425 const TInt KErrHttpEncodeIfMatch = KHttpHeaderEncodeErrorBase - 18;
427 Error encoding the if none match field
431 const TInt KErrHttpEncodeIfNoneMatch = KHttpHeaderEncodeErrorBase - 19;
433 Error encoding the if modified since field
437 const TInt KErrHttpEncodeIfModifiedSince = KHttpHeaderEncodeErrorBase - 20;
439 Error encoding the if unmodified since field
443 const TInt KErrHttpEncodeIfUnmodifiedSince = KHttpHeaderEncodeErrorBase - 21;
445 Error encoding the Cookie2 field
449 const TInt KErrHttpEncodeCookie2 = KHttpHeaderEncodeErrorBase - 22;
451 Error encoding the Content-Language field
455 const TInt KErrHttpEncodeContentLanguage = KHttpHeaderEncodeErrorBase - 23;
457 Error encoding the WWWAuthenticate field
461 const TInt KErrHttpEncodeDoWWWAuthenticate = KHttpHeaderEncodeErrorBase - 24;
463 Error encoding the Age field
467 const TInt KErrHttpEncodeDoAge = KHttpHeaderEncodeErrorBase - 25;
469 Error encoding the Vary field
473 const TInt KErrHttpEncodeDoVary = KHttpHeaderEncodeErrorBase - 26;
475 Error encoding the Content-Language field
479 const TInt KErrHttpEncodeDoContentLanguage = KHttpHeaderEncodeErrorBase - 27;
481 Error encoding the Content-Encoding field
485 const TInt KErrHttpEncodeContentEncoding = KHttpHeaderEncodeErrorBase - 28;
487 Error encoding the Content-Location field
491 const TInt KErrHttpEncodeContentLocation = KHttpHeaderEncodeErrorBase - 29;
493 Error encoding the Content-MD5 field
497 const TInt KErrHttpEncodeContentMD5 = KHttpHeaderEncodeErrorBase - 30;
499 Error encoding the Accept-Encoding field
503 const TInt KErrHttpEncodeAcceptLanguage = KHttpHeaderEncodeErrorBase - 31;
505 Error encoding the Accept-Language field
509 const TInt KErrHttpEncodeAcceptEncoding = KHttpHeaderEncodeErrorBase - 32;
511 Error encoding the TE field
515 const TInt KErrHttpEncodeTE = KHttpHeaderEncodeErrorBase - 33;
517 Error encoding the Upgrade field
521 const TInt KErrHttpEncodeUpgrade = KHttpHeaderEncodeErrorBase - 34;
523 Error encoding the ST field
527 const TInt KErrHttpEncodeST = KHttpHeaderEncodeErrorBase - 35;
529 Error encoding the USN field
533 const TInt KErrHttpEncodeUSN = KHttpHeaderEncodeErrorBase - 36;
535 Error encoding the Timeout field
539 const TInt KErrHttpEncodeTimeout = KHttpHeaderEncodeErrorBase - 37;
541 Error encoding the EXT field
545 const TInt KErrHttpEncodeExt = KHttpHeaderEncodeErrorBase - 38;
547 Error encoding the SID field
551 const TInt KErrHttpEncodeSID = KHttpHeaderEncodeErrorBase - 39;
553 Error encoding the NTS field
557 const TInt KErrHttpEncodeNTS = KHttpHeaderEncodeErrorBase - 40;
559 Error encoding the NT field
563 const TInt KErrHttpEncodeNT = KHttpHeaderEncodeErrorBase - 41;
565 Error encoding the MX field
569 const TInt KErrHttpEncodeMX = KHttpHeaderEncodeErrorBase - 42;
571 Error encoding the SEQ field
575 const TInt KErrHttpEncodeSEQ = KHttpHeaderEncodeErrorBase - 43;
577 Error encoding the MAN field
581 const TInt KErrHttpEncodeMAN = KHttpHeaderEncodeErrorBase - 44;
583 Error encoding the SoapAction field
587 const TInt KErrHttpEncodeSoapAction = KHttpHeaderEncodeErrorBase - 45;
589 Error encoding the Callback field
593 const TInt KErrHttpEncodeCallback = KHttpHeaderEncodeErrorBase - 46;
596 Codec decoding errors for values found in HTTP headers
600 const TInt KHttpValueDecodeErrorBase = KHttpErrorBase - 60;
603 General formatting error for date values
607 const TInt KErrHttpDecodeMalformedDate = KHttpValueDecodeErrorBase;
613 const TInt KErrHttpDecodeMalformedYear = KHttpValueDecodeErrorBase - 1;
615 Malformed short month name
619 const TInt KErrHttpDecodeMalformedMonth = KHttpValueDecodeErrorBase - 2;
621 Malformed number of day in month
625 const TInt KErrHttpDecodeMalformedDay = KHttpValueDecodeErrorBase - 3;
627 Malformed short day name
631 const TInt KErrHttpDecodeMalformedWkDay = KHttpValueDecodeErrorBase - 4;
633 Malformed long day name
637 const TInt KErrHttpDecodeMalformedWeekDay = KHttpValueDecodeErrorBase - 5;
639 Malformed integer value
643 const TInt KErrHttpDecodeMalformedInteger = KHttpValueDecodeErrorBase - 6;
645 Malformed quoted string
649 const TInt KErrHttpDecodeMalformedQuotedStr = KHttpValueDecodeErrorBase - 7;
652 Codec decoding errors for HTTP headers
656 const TInt KHttpHeaderDecodeErrorBase = KHttpErrorBase - 70;
659 Error decoding the Accept field
663 const TInt KErrHttpDecodeAccept = KHttpHeaderDecodeErrorBase;
665 Error decoding the Connection field
669 const TInt KErrHttpDecodeConnection = KHttpHeaderDecodeErrorBase - 1;
671 Error decoding the Content-Length field
675 const TInt KErrHttpDecodeContentLength = KHttpHeaderDecodeErrorBase - 2;
677 Error decoding the Content-Type field
681 const TInt KErrHttpDecodeContentType = KHttpHeaderDecodeErrorBase - 3;
683 Error decoding the Transfer-Encoding field
687 const TInt KErrHttpDecodeTransferEncoding = KHttpHeaderDecodeErrorBase - 4;
689 Error decoding the WWWAuthenticate field
693 const TInt KErrHttpDecodeWWWAuthenticate = KHttpHeaderDecodeErrorBase - 5;
695 The WWWAuthenticate field contained an unrecognised authentication scheme
699 const TInt KErrHttpDecodeUnknownAuthScheme = KHttpHeaderDecodeErrorBase - 6;
701 Error decoding a Basic WWWAuthenticate challenge
705 const TInt KErrHttpDecodeBasicAuth = KHttpHeaderDecodeErrorBase - 7;
707 Error decoding a Digest WWWAuthenticate challenge
711 const TInt KErrHttpDecodeDigestAuth = KHttpHeaderDecodeErrorBase - 8;
713 Error decoding a Set-Cookie field
717 const TInt KErrHttpDecodeCookie = KHttpHeaderDecodeErrorBase - 9;
719 Error decoding the Authorization field
723 const TInt KErrHttpDecodeAuthorization = KHttpHeaderDecodeErrorBase - 10;
725 Error decoding the Accept-Charset field
729 const TInt KErrHttpDecodeAcceptCharset = KHttpHeaderDecodeErrorBase - 11;
731 Error decoding the Accept-Language field
735 const TInt KErrHttpDecodeAcceptLanguage = KHttpHeaderDecodeErrorBase - 12;
737 Error decoding the Accept-Encoding field
741 const TInt KErrHttpDecodeAcceptEncoding = KHttpHeaderDecodeErrorBase - 13;
743 Error decoding the TE field
747 const TInt KErrHttpDecodeTE = KHttpHeaderEncodeErrorBase - 14;
749 Error decoding the Expect field
753 const TInt KErrHttpDecodeExpect = KHttpHeaderEncodeErrorBase - 15;
755 Error decoding the Content-Disposition field
759 const TInt KErrHttpDecodeContentDisposition = KHttpHeaderDecodeErrorBase - 14;
761 Error decoding the MAN field.
765 const TInt KErrHttpDecodeMAN = KHttpHeaderDecodeErrorBase - 15;
767 Response errors. These represent specific failure cases
771 const TInt KErrHttpResponseFailureBase = KHttpErrorBase - 100;
774 A uri redirected too many times, possibly indicating a circular redirection
778 const TInt KErrHttpRedirectExceededLimit = KErrHttpResponseFailureBase;
780 A server responded that the uri must be fetched via a proxy
784 const TInt KErrHttpRedirectUseProxy = KErrHttpResponseFailureBase - 1;
786 A server sent a redirection response that did not include a Location header
790 const TInt KErrHttpRedirectNoLocationField = KErrHttpResponseFailureBase - 2;
792 An error occured in parsing which left the parser in a unknown state
796 const TInt KErrHttpUnknownParseState = KErrHttpResponseFailureBase - 3;
799 Request building errors: cause the Validation Filter to make a transaction fail and terminate
803 const TInt KErrHttpReqBuildErrorBase = KHttpErrorBase - 130;
806 A body is provided with a method that doesn't allow bodys to be transmitted
810 const TInt KErrHttpRequestHasBody = KErrHttpReqBuildErrorBase;
812 A body is missing from a method that requires it
816 const TInt KErrHttpRequestBodyMissing = KErrHttpReqBuildErrorBase - 1;
818 Should contain The Max-Forward header
822 const TInt KErrHttpTraceReqWithoutMaxForwardHeader = KErrHttpReqBuildErrorBase - 2;
824 Body must NOT be sent chunked if using HTTP/1.0
828 const TInt KErrHttpPostReqBodyWithoutSizeOnHTTP10 = KErrHttpReqBuildErrorBase - 3;
830 Request contained a response header or a entity header but no body
834 const TInt KErrHttpInvalidHeaderInRequest = KErrHttpReqBuildErrorBase - 4;
836 Missing but required header errors
841 const TInt KErrHttpMissingHeaderBase = KHttpErrorBase - 160;
843 A body was provided in the request but no Content-Type header was set
848 const TInt KErrHttpEntityHeaderMissingContentType = KErrHttpMissingHeaderBase;
850 The request URI was relative, but no Host header was set to indicate a server to connect to
854 const TInt KErrHttpGeneralHeaderMissingHost = KErrHttpMissingHeaderBase - 1;
856 Protocol handler errors
860 const TInt KErrHttpProtocolHandlerBase = KHttpErrorBase - 170;
862 The request body needed to be rewound but the client but it doesn't support
866 const TInt KErrHttpCantResetRequestBody = KErrHttpProtocolHandlerBase;
868 The Protocol handler is not initialised
872 const TInt KErrHttpProtTransactionNotInitialised = KErrHttpProtocolHandlerBase -1;
874 Unable to establish a tunnel.
878 const TInt KErrHttpCannotEstablishTunnel = KErrHttpProtocolHandlerBase -2;
884 const TInt KErrHttpInvalidUri = KErrHttpProtocolHandlerBase -3;
886 Protocol handler experienced a non-pipelining error
890 const TInt KErrHttpNonPipeliningError = KErrHttpProtocolHandlerBase -4;
892 Protocol handler experienced a pipelining error
896 const TInt KErrHttpPipeliningError = KErrHttpProtocolHandlerBase -5;
899 The request has been not sent for the transaction and connection has been disconnected.
900 This error will be propagated to the client only, if the HTTP:ENotifyOnDisconnect property
901 is set with a value HTTP::EEnableDisconnectNotification
906 const TInt KErrHttpRequestNotSent = KErrHttpProtocolHandlerBase -6;
909 The response has been not received for the transaction and connection has been disconnected.
910 This error will be propagated to the client only, if the HTTP:ENotifyOnDisconnect property is
911 set with a value HTTP::EEnableDisconnectNotification
916 const TInt KErrHttpResponseNotReceived = KErrHttpProtocolHandlerBase -7;
919 Partial response has been received and connection has been disconnected. This error will be
920 propagated to the client only, if the HTTP:ENotifyOnDisconnect property is set with a value
921 HTTP::EEnableDisconnectNotification
926 const TInt KErrHttpPartialResponseReceived = KErrHttpProtocolHandlerBase -8;
929 ClientApplication wants to fail the transaction that was in process by the HTTPMessageParser
933 const TInt KErrHttpOptimiserFailsTrans = KErrHttpProtocolHandlerBase -9;
935 // end of error codes - maximum error value is -7399 - must not be exceeded!
936 // Inline methods from HTTPStatus
938 inline TBool HTTPStatus::IsInformational(TInt aStatus)
940 return ((aStatus >= HTTPStatus::EContinue) && (aStatus < HTTPStatus::EOk));
942 inline TBool HTTPStatus::IsSuccessful(TInt aStatus)
944 return ((aStatus >= HTTPStatus::EOk) && (aStatus < HTTPStatus::EMultipleChoices));
946 inline TBool HTTPStatus::IsRedirection(TInt aStatus)
948 return ((aStatus >= HTTPStatus::EMultipleChoices) && (aStatus < HTTPStatus::EBadRequest));
950 inline TBool HTTPStatus::IsClientError(TInt aStatus)
952 return ((aStatus >= HTTPStatus::EBadRequest) && (aStatus < HTTPStatus::EInternalServerError));
954 inline TBool HTTPStatus::IsServerError(TInt aStatus)
956 return (aStatus >= HTTPStatus::EInternalServerError);
961 #endif // __HTTPERR_H__