HTTP Services

From 3dbrew
Jump to navigation Jump to search

HTTP service "http:C"

Command Header Available since system-version Available from service-sessions Description
0x00010044 Initialize
0x00020082 Main-only CreateContext
0x00030040 All CloseContext
0x00040040 CancelConnection
0x00050040 GetRequestState
0x00060040 GetDownloadSizeState
0x00070040 GetRequestError
0x00080042 InitializeConnectionSession
0x00090040 BeginRequest
0x000A0040 BeginRequestAsync
0x000B0082 ReceiveData
0x000C0102 ReceiveDataTimeout
0x000D0146 SetProxy
0x000E0040 SetProxyDefault
0x000F00C4 SetBasicAuthorization
0x00100080 SetSocketBufferSize
0x001100C4 AddRequestHeader
0x001200C4 AddPostDataAscii
0x001300C4 AddPostDataBinary
0x00140082 AddPostDataRaw
0x00150080 SetPostDataType(u8 enum)
0x001600C4 SendPostDataAscii
0x00170144 SendPostDataAsciiTimeout
0x001800C4 SendPostDataBinary
0x00190144 SendPostDataBinaryTimeout
0x001A0082 SendPostDataRaw
0x001B0102 SendPOSTDataRawTimeout
0x001C0080 SetPostDataEncoding
0x001D0040 NotifyFinishSendPostData
0x001E00C4 GetResponseHeader
0x001F0144 GetResponseHeaderTimeout
0x00200082 GetResponseData
0x00210102 GetResponseDataTimeout
0x00220040 GetResponseStatusCode
0x002300C0 GetResponseStatusCodeTimeout
0x00240082 AddTrustedRootCA
0x00250080 AddDefaultCert
0x00260080 SelectRootCertChain
0x002700C4 SetClientCert
0x00280080 Somehow related to SetClientCert.
0x00290080
0x002A0040 GetSSLError?
0x002B0080 Context-only SetSSLOpt
0x002C0080 Context-only SetSSLClearOpt
0x002D0000 Main-only CreateRootCertChain
0x002E0040 Main-only DestroyRootCertChain
0x002F0082 Main-only RootCertChainAddCert
0x00300080 Main-only RootCertChainAddDefaultCert
0x00310080 Main-only RootCertChainRemoveCert
0x00320084 Main-only
0x00330040 Main-only
0x00340040 Main-only
0x00350186 Main-only SetDefaultProxy
0x00360000 ClearDNSCache
0x00370080 SetKeepAlive (bool)
0x003800C0 Unknown, >2.0.0-X. SetPostDataTypeSize (u8 enum, u32 size) (similar to SetPostDataType)
0x00390000 Unknown, >2.0.0-X. Finalize
0x003A0080 Unknown, >2.0.0-X.
0x003B0082 Unknown, >2.0.0-X.
0x003C0080 Unknown, >2.0.0-X.
0x003D0080 Unknown, >2.0.0-X.
0x003E0000 Unknown, >2.0.0-X.
0x003F0040 Unknown, >2.0.0-X.
0x00400082 Unknown, >2.0.0-X.
0x00410080 Unknown, >2.0.0-X.
0x00420080 Unknown, >2.0.0-X.

TLS Root CAs

Initially a HTTP context will not trust any root-CAs at all. Which root-CAs to trust must be explicitly specified via the add-root-CA service command(s).

RootCertChains can be used to easily select a particular chain of trusted root-CAs with multiple HTTP contexts, without having to re-send each of the root-CA commands for each HTTP context. The maximum number of RootCertChains that can exist for a HTTPC service session handle, is only 1.

When using the context-specific RootCA commands such as HTTPC:AddTrustedRootCA where HTTPC:SelectRootCertChain was already used, the cert will just be added to the selected RootCertChain.

Error codes

Error code Description
0xd8a0a03c The HTTPS server's TLS certificate is signed by an unknown/not-trusted root CA.
0xd8a0a046 This is returned by HTTPC:Initialize when no network connection is available(or at least when wifi is disabled via Home Menu on New3DS).
0xd8a0a066 This indicates that the context handle is wrong.