HTTP Services

HTTP Services

HTTP service “http:C” #

Command HeaderAvailable since system-versionAvailable from service-sessionsDescription
0x000100441.0.0-0Initialize
0x000200821.0.0-0Main-onlyCreateContext
0x000300401.0.0-0AllCloseContext
0x000400401.0.0-0CancelConnection
0x000500401.0.0-0GetRequestState
0x000600401.0.0-0GetDownloadSizeState
0x000700401.0.0-0GetRequestError
0x000800421.0.0-0InitializeConnectionSession
0x000900401.0.0-0BeginRequest
0x000A00401.0.0-0BeginRequestAsync
0x000B00821.0.0-0ReceiveData
0x000C01021.0.0-0ReceiveDataTimeout
0x000D01461.0.0-0SetProxy
0x000E00401.0.0-0SetProxyDefault
0x000F00C41.0.0-0SetBasicAuthorization
0x001000801.0.0-0Context-onlySetSocketBufferSize
0x001100C41.0.0-0AddRequestHeader
0x001200C41.0.0-0AddPostDataAscii
0x001300C41.0.0-0AddPostDataBinary
0x001400821.0.0-0AddPostDataRaw
0x001500801.0.0-0SetPostDataType(u8 enum)
0x001600C41.0.0-0SendPostDataAscii
0x001701441.0.0-0SendPostDataAsciiTimeout
0x001800C41.0.0-0SendPostDataBinary
0x001901441.0.0-0SendPostDataBinaryTimeout
0x001A00821.0.0-0SendPostDataRaw
0x001B01021.0.0-0SendPOSTDataRawTimeout
0x001C00801.0.0-0SetPostDataEncoding
0x001D00401.0.0-0NotifyFinishSendPostData
0x001E00C41.0.0-0GetResponseHeader
0x001F01441.0.0-0GetResponseHeaderTimeout
0x002000821.0.0-0GetResponseData
0x002101021.0.0-0GetResponseDataTimeout
0x002200401.0.0-0GetResponseStatusCode
0x002300C01.0.0-0GetResponseStatusCodeTimeout
0x002400821.0.0-0AddTrustedRootCA
0x002500801.0.0-0AddDefaultCert
0x002600801.0.0-0SelectRootCertChain
0x002700C41.0.0-0SetClientCert
0x002800801.0.0-0Context-onlySetClientCertDefault
0x002900801.0.0-0Context-onlySetClientCertContext
0x002A00401.0.0-0All(u32 contexthandle) GetSSLError? This loads a value from state, this doesn’t seem to use any sslc command.
0x002B00801.0.0-0Context-onlySetSSLOpt
0x002C00801.0.0-0Context-onlySetSSLClearOpt
0x002D00001.0.0-0Main-onlyCreateRootCertChain
0x002E00401.0.0-0Main-onlyDestroyRootCertChain
0x002F00821.0.0-0Main-onlyRootCertChainAddCert
0x003000801.0.0-0Main-onlyRootCertChainAddDefaultCert
0x003100801.0.0-0Main-onlyRootCertChainRemoveCert
0x003200841.0.0-0Main-onlyOpenClientCertContext
0x003300401.0.0-0Main-onlyOpenDefaultClientCertContext
0x003400401.0.0-0Main-onlyCloseClientCertContext
0x003501861.0.0-0Main-onlySetDefaultProxy
0x003600001.0.0-0ClearDNSCache
0x003700802.0.0-XSetKeepAlive (bool)
0x003800C03.0.0-X.SetPostDataTypeSize (u8 enum, u32 size) (similar to SetPostDataType)
0x003900003.0.0-X.Finalize
0x003A00808.0.0-XSetKeepAlive?
0x003B00829.0.0-XSetCrl
0x003C00809.0.0-XSetInternalCrl
0x003D00809.0.0-XSetCrlStore
0x003E00009.0.0-XCreateCrlStore
0x003F00409.0.0-XDestroyCrlStore
0x004000829.0.0-XAddCrlToCrlStore
0x004100809.0.0-XAddInternalCrl
0x004200409.0.0-XRemoveCrlFromCrlStore

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 an user-process, is only 2.

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.

ClientCert Contexts #

These are basically the same as RootCertChains except for TLS client cert+privk. The maximum number of ClientCert-contexts that can exist for an user-process, is only 2.

Error codes #

Error codeDescription
0xd8a0a03cFailed to verify the HTTPS server’s TLS certificate.
0xd8a0a046This is returned by HTTPC:Initialize when no network connection is available(or at least when wifi is disabled via Home Menu on New3DS). Seems to be caused by DNS lookup failure( SOCU:getaddrinfo returning an error).
0xd8a0a049Seems to be caused by a socket connect() timeout error?
0xd8a0a066This indicates that the context handle is wrong.
0xd820a069This is returned when the call times out (with any call with a timeout arg)

Category:Services