5 Replies
      Latest reply on Oct 21, 2019 4:59 AM by eskimo
      mxyan Level 1 Level 1 (0 points)

        It looks like it was not there a while ago (except writing my own HTTP parser with low level networking APIs) and I do not see any recent documentation about it. But still hope to ask here in case I missed anything. Is there any plan or work in progress on this feature?

        • Re: Does any networking API support receiving HTTP trailers on iOS?
          john daniel Level 3 Level 3 (450 points)

          It looks like it has been supported for some time: developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Trailer

          • Re: Does any networking API support receiving HTTP trailers on iOS?
            eskimo Apple Staff Apple Staff (12,095 points)

            A quick of the CFNetwork source suggests that this is supported, with the resulting ‘header’ fields showing up alongside the normal header fields in the NSHTTPURLResponse.  Have you tried it?

            Share and Enjoy

            Quinn “The Eskimo!”
            Apple Developer Relations, Developer Technical Support, Core OS/Hardware
            let myEmail = "eskimo" + "1" + "@apple.com"

              • Re: Does any networking API support receiving HTTP trailers on iOS?
                mxyan Level 1 Level 1 (0 points)

                I tried with a NSURLSessionUploadTask (both completion block style and delegate style) with some service that replies trailers, and it does not look like the response header in the completion block parameter include any of the trailer fields. Not sure if I understood you correctly eskimo; am I using the right approach?

                  • Re: Does any networking API support receiving HTTP trailers on iOS?
                    eskimo Apple Staff Apple Staff (12,095 points)

                    Honestly, I’ve never actually tried this, so I’m not 100% clear how the trailers get integrated into a response that you have access to.  I was hoping that this would Just Work™, but that doesn’t seem to be the case.

                    Clearly I need to dig into this some more, and I don’t have time to do that in the context of DevForums.  If you open a DTS tech support incident, I’d be happy to take things from there.

                    Share and Enjoy

                    Quinn “The Eskimo!”
                    Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                    let myEmail = "eskimo" + "1" + "@apple.com"

                      • Re: Does any networking API support receiving HTTP trailers on iOS?
                        eskimo Apple Staff Apple Staff (12,095 points)

                        mxyan opened a DTS incident about this, which allowed me to dig into it.  It turns out that the quick check I mentioned in my 13 Oct post was a little too quick )-:  It is true that CFNetwork’s core HTTP engine parses the trailers, but I misread how it surfaces those to higher-level code.  The trailers are not merged into the NSHTTPURLResponse, but rather stored in a separate property.  Unfortunately that property is not part of the public API )-:  We have a bug on file requesting a public API for this (r. 26845013).

                        Share and Enjoy

                        Quinn “The Eskimo!”
                        Apple Developer Relations, Developer Technical Support, Core OS/Hardware
                        let myEmail = "eskimo" + "1" + "@apple.com"