1
votes

I am using ASIHTTPRequest, and i have to make use of the POST method to send some values to the server. So, for this i have to set headers and its corresponding values.

ASIHTTPRequest *request = [ASIHTTPRequest requestWithURL:url];
[request addRequestHeader:@"Referer" value:@"http://allseeing-i.com/"];

The following are headers that is needed to be included in my application, and how could i include the once with Semi-Colons ("Content-Type" = "text/html"; , "Keep-Alive" = "timeout=15, max=100"; etc)

    "Content-Type" = "text/html";

    Date = "Wed, 21 Jun 2011 09:09:57 GMT";

    "Keep-Alive" = "timeout=15, max=100";

    Server = Apache;

    "Transfer-Encoding" = Identity;
2

2 Answers

5
votes

Just use addRequestHeader in the same way as you're setting Referer. You don't need to include those semicolons - I think the ; are only there as an artifact of the method used to capture the headers. You do not use ; like that in HTTP.

eg:

[request addRequestHeader:@"Keep-Alive" value:@"timeout=15, max=100"];
1
votes

You just have to add [request setRequestMethod:@"POST"];