/*-------------------------------------------------------------------------------------------------------------------
函数功能:发送HTTP头
参 数:sockfd 服务器句柄;
head HTTP头
返回值: 成功返回0,失败返回错误代码
--------------------------------------------------------------------------------------------------------------------*/
int SendHttpHead(int sockfd, HTTPHEAD head)
{
char data[100];
char dataEnc[100];
char httphead[500] = "POST ";
strcat(httphead, head.servicename);
strcat(httphead, " HTTP/1.0\n");
strcat(httphead, "Connection: keep-alive\n");
strcat(httphead, "Content-Type: text/html; charset=\"gb2312\"\n");
strcat(httphead, "Content-Length: ");
strcat(httphead, head.ContentLength);
strcat(httphead, "\n");
strcat(httphead, "Host: ");
strcat(httphead, head.HostIP);
strcat(httphead, ":");
strcat(httphead, head.HostPort);
strcat(httphead, "\n");
strcat(httphead, "Accept: text/html, */*\n");
strcat(httphead, "User-Agent: Mozilla/3.0 (compatible; Indy Library)\n");
strcat(httphead, "Authorization: Basic ");
strcpy(data, head.TaxPayerNO);
strcat(data, ":");
strcat(data, "888888\n");
Base64_Enc(dataEnc, data, strlen(data));
strcat(httphead, dataEnc);
strcat(httphead, "proxy-Authorization: Basic Og==\n");
if ( send(sockfd, httphead, strlen(httphead) ,0) == -1 )
{
return -1;
}
return 0;
}
函数功能:发送HTTP头
参 数:sockfd 服务器句柄;
head HTTP头
返回值: 成功返回0,失败返回错误代码
--------------------------------------------------------------------------------------------------------------------*/
int SendHttpHead(int sockfd, HTTPHEAD head)
{
char data[100];
char dataEnc[100];
char httphead[500] = "POST ";
strcat(httphead, head.servicename);
strcat(httphead, " HTTP/1.0\n");
strcat(httphead, "Connection: keep-alive\n");
strcat(httphead, "Content-Type: text/html; charset=\"gb2312\"\n");
strcat(httphead, "Content-Length: ");
strcat(httphead, head.ContentLength);
strcat(httphead, "\n");
strcat(httphead, "Host: ");
strcat(httphead, head.HostIP);
strcat(httphead, ":");
strcat(httphead, head.HostPort);
strcat(httphead, "\n");
strcat(httphead, "Accept: text/html, */*\n");
strcat(httphead, "User-Agent: Mozilla/3.0 (compatible; Indy Library)\n");
strcat(httphead, "Authorization: Basic ");
strcpy(data, head.TaxPayerNO);
strcat(data, ":");
strcat(data, "888888\n");
Base64_Enc(dataEnc, data, strlen(data));
strcat(httphead, dataEnc);
strcat(httphead, "proxy-Authorization: Basic Og==\n");
if ( send(sockfd, httphead, strlen(httphead) ,0) == -1 )
{
return -1;
}
return 0;
}