• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Setting HTTP Status Code/Description after CFHTTPMessageCreateEmpty
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Setting HTTP Status Code/Description after CFHTTPMessageCreateEmpty


  • Subject: Re: Setting HTTP Status Code/Description after CFHTTPMessageCreateEmpty
  • From: Becky Willrich <email@hidden>
  • Date: Sun, 1 Apr 2007 16:22:03 -0700

I'm having trouble figuring out how to set the HTTP status code and description if I create a CFHTTPMessage using CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE). The CFHTTPMessageCreateResponse function has arguments for the status code and description, but there doesn't seem to be a way to set those if I use CFHTTPMessageCreateEmpty. Are there functions to set those values?

CFHTTPMessageCreateEmpty() is really only intended for use when you're populating the message from a byte stream (like if you're receiving it from a server); you call CFHTTPMessageCreateEmpty() and then as they bytes arrive, you call CFHTTPMessageAppendBytes(). If you're constructing the message programmatically (i.e. you know it's a response with a 404 status code and you have the pre-computed header dict somewhere), you're better off using CFHTTPMessageCreateResponse() plus CFHTTPMessageSetHeaderFieldValue().


However, to answer your question - if you're starting with CFHTTPMessageCreateEmpty(), you'd call CFHTTPMessageAppendBytes() with the appropriate bytes for the response type you want to set the status code.


Hope that helps - REW _______________________________________________ Do not post admin requests to the list. They will be ignored. Macnetworkprog mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
References: 
 >Setting HTTP Status Code/Description after CFHTTPMessageCreateEmpty (From: King Chung Huang <email@hidden>)

  • Prev by Date: Delay in NSHTTPCookieStorage
  • Next by Date: Re: Delay in NSHTTPCookieStorage
  • Previous by thread: Setting HTTP Status Code/Description after CFHTTPMessageCreateEmpty
  • Next by thread: Delay in NSHTTPCookieStorage
  • Index(es):
    • Date
    • Thread