C로 http post 요청시에...

dreampia의 이미지

C로 http post 방식요청을 할 경우에 대한 질문입니다.
혹시 예제 있으신분 있나요?

제 경우는 직접 socket().. connect().. 로 연결맺어서 data를 아래와 같이 setting해서 보내는데..
호출은 잘 되는데 parameter가 전달이 되지 않습니다..

    memset(data, 0x00, sizeof(data));
    sprintf(data, "toUser=dreampia&title=11&message=11111");

    memset(buff, 0x00, sizeof(buff));
    sprintf(buff, "POST /test/print.jsp HTTP/1.0\r\n"
                  "User-agent: Mozilla\r\n"
                  "Referer: http://192.168.0.2/test/print2.jsp\r\n"
                  "Content-type: application/x-www-form-urlencodeed\r\n"
                  "Content-length: %d\r\n"
                  "\r\n%s\r\n",
        strlen(data), data);

위의 값 setting후에 바로 send()호출하는데
응답을 받으면 전부 NULL로 되서요..

다른 부분 더 setting해야 할 것이 있을까요?
post로 전달하는 parameter 값 setting에 뭐가 문제가 있는걸까요? 방식이 잘못된건가...ㅠㅠ

POST /test/print.jsp HTTP/1.0
User-agent: Mozilla
Referer: http://192.168.0.2/test/print2.jsp
Content-type: application/x-www-form-urlencodeed
Content-length: 52

toUser=dreampia&title=11&message=11111





HTTP/1.0 200 OK
Date: Wed, 05 Jan 2005 07:04:49 GMT
Server: Jeus WebContainer/3.3.14.3
Content-Type: text/html;charset=KSC5601
Set-Cookie: JSESSIONID=dKN94tYGRM4WB1ecVDmWt;Path=/




toUser [null]<br>
title [null]<br>
message [null]<br>


nohmad의 이미지

특별히 안될 이유는 없어보이는데,

Content-type: application/x-www-form-urlencodeed

혹시 여기서 urlencoded 철자 오류 때문은 아닐까요?