|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
ASIOHello, I am trying to do a POST request using Boost::Asio, of a variable x that holds an email address, and a variable y that holds the contents of a zip file. I couldn't find samples floating around and I'm unsure of how to proceed. I've come up with the following code: boost::asio::streambuf request; std::ostream request_stream(&request); wxString buffer = wxT("POST "); buffer += wxT("http://serveraddress.com"); buffer += wxT(" HTTP/1.1\r\n"); buffer += wxT("Host: serveraddress.com\r\n"); buffer += wxT("Accept: */*\r\n"); buffer += wxT("Connection: close\r\n\r\n"); buffer += wxT("email_address=test@..."); buffer += wxT("zip_file=")/*actual zip file data here?*/; request_stream << buffer.mb_str(); Note that I am using wxWidgets, wxT is nothing more than a way of defining strings there, and wxString is, well, a string. The above code compiles fine, but I am not sure how to add the zip file? Also would the above code work? I know it is working for a GET request but that's it. Please advise. Thanks for your time, Mohammed _________________________________________________________________ Keep your friends updated—even when you’re not signed in. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost |
|
|
Re: ASIOMohammed Rasmy wrote:
> Hello, > > > > I am trying to do a POST request using Boost::Asio, of a variable x > that holds an email address, and a variable y that holds the contents > of a zip file. > > > > I couldn't find samples floating around and I'm unsure of how to > proceed. I've come up with the following code: > > > > boost::asio::streambuf request; > > std::ostream request_stream(&request); > > > > wxString buffer = wxT("POST "); > > buffer += wxT("http://serveraddress.com"); > > buffer += wxT(" HTTP/1.1\r\n"); > > buffer += wxT("Host: serveraddress.com\r\n"); > > buffer += wxT("Accept: */*\r\n"); > > buffer += wxT("Connection: close\r\n\r\n"); > > buffer += wxT("email_address=test@..."); > > buffer += wxT("zip_file=")/*actual zip file data here?*/; > > request_stream << buffer.mb_str(); > > > > Note that I am using wxWidgets, wxT is nothing more than a way of > defining strings there, and wxString is, well, a string. The above code > compiles fine, but I am not sure how to add the zip file? Also would > the above code work? I know it is working for a GET request but that's > it. Please advise. > > > > Thanks for your time, > > Mohammed > > > > _________________________________________________________________ > Keep your friends updated—even when you’re not signed in. > http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost buffer += wxT("email_address=test@..."); to buffer += wxT("email_address=test@...&"); or buffer += wxT("zip_file=")/*actual zip file data here?*/; to buffer += wxT("&zip_file=")/*actual zip file data here?*/; _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost |
|
|
Re: ASIOUh, is this not a question about HTTP standards, rather than a Boost
library (since the Boost library use worked)? I.e., fairly OT? /David On Nov 5, 2009, at 8:20 AM, Jarrad Waterloo wrote: > Mohammed Rasmy wrote: >> Hello, >> >> >> >> I am trying to do a POST request using Boost::Asio, of a variable x >> that holds an email address, and a variable y that holds the contents >> of a zip file. >> >> >> >> I couldn't find samples floating around and I'm unsure of how to >> proceed. I've come up with the following code: >> >> >> >> boost::asio::streambuf request; >> >> std::ostream request_stream(&request); >> >> >> >> wxString buffer = wxT("POST "); >> >> buffer += wxT("http://serveraddress.com"); >> >> buffer += wxT(" HTTP/1.1\r\n"); >> >> buffer += wxT("Host: serveraddress.com\r\n"); >> >> buffer += wxT("Accept: */*\r\n"); >> >> buffer += wxT("Connection: close\r\n\r\n"); >> >> buffer += wxT("email_address=test@..."); >> >> buffer += wxT("zip_file=")/*actual zip file data here?*/; >> >> request_stream << buffer.mb_str(); >> >> >> >> Note that I am using wxWidgets, wxT is nothing more than a way of >> defining strings there, and wxString is, well, a string. The above >> code >> compiles fine, but I am not sure how to add the zip file? Also would >> the above code work? I know it is working for a GET request but >> that's >> it. Please advise. >> >> >> >> Thanks for your time, >> >> Mohammed >> >> >> >> _________________________________________________________________ >> Keep your friends updated—even when you’re not signed in. >> http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 >> _______________________________________________ >> Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > I don't know for sure but where is your '&'. Try changing > > buffer += wxT("email_address=test@..."); > to > buffer += wxT("email_address=test@...&"); > or > buffer += wxT("zip_file=")/*actual zip file data here?*/; > to > buffer += wxT("&zip_file=")/*actual zip file data here?*/; > > > > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost |
|
|
Re: ASIOYes, I missed to include the "&", thanks for pointing that out. Any idea on how to send off the contents of a zip file? > Date: Thu, 5 Nov 2009 08:20:05 -0500 > From: jwaterloo@... > To: boost@... > Subject: Re: [boost] ASIO > > Mohammed Rasmy wrote: > > Hello, > > > > > > > > I am trying to do a POST request using Boost::Asio, of a variable x > > that holds an email address, and a variable y that holds the contents > > of a zip file. > > > > > > > > I couldn't find samples floating around and I'm unsure of how to > > proceed. I've come up with the following code: > > > > > > > > boost::asio::streambuf request; > > > > std::ostream request_stream(&request); > > > > > > > > wxString buffer = wxT("POST "); > > > > buffer += wxT("http://serveraddress.com"); > > > > buffer += wxT(" HTTP/1.1\r\n"); > > > > buffer += wxT("Host: serveraddress.com\r\n"); > > > > buffer += wxT("Accept: */*\r\n"); > > > > buffer += wxT("Connection: close\r\n\r\n"); > > > > buffer += wxT("email_address=test@..."); > > > > buffer += wxT("zip_file=")/*actual zip file data here?*/; > > > > request_stream << buffer.mb_str(); > > > > > > > > Note that I am using wxWidgets, wxT is nothing more than a way of > > defining strings there, and wxString is, well, a string. The above code > > compiles fine, but I am not sure how to add the zip file? Also would > > the above code work? I know it is working for a GET request but that's > > it. Please advise. > > > > > > > > Thanks for your time, > > > > Mohammed > > > > > > > > _________________________________________________________________ > > Keep your friends updated—even when you’re not signed in. > > http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_5:092010 > > _______________________________________________ > > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost > I don't know for sure but where is your '&'. Try changing > > buffer += wxT("email_address=test@..."); > to > buffer += wxT("email_address=test@...&"); > or > buffer += wxT("zip_file=")/*actual zip file data here?*/; > to > buffer += wxT("&zip_file=")/*actual zip file data here?*/; > > > > _______________________________________________ > Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost _________________________________________________________________ Windows Live: Keep your friends up to date with what you do online. http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_1:092010 _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost |
|
|
Please don't overquotePlease try to keep the list and its archives readable by pruning the quoted text before posting (http://www.boost.org/community/policy.html#quoting)! -- Dave Abrahams Meet me at BoostCon: http://www.boostcon.com Boost Moderator _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost |
| Free embeddable forum powered by Nabble | Forum Help |