Sign in to follow this  
guddi1

how to display parameters of a post request

Recommended Posts

Hi, I am looking to figure out how to display parameters of a post request. I am working in visual C++ environment. I have a program that tracks and outputs URL activity. For instance, when I log in to my yahoo email account, the program outputs the following headers: (Request for https://login.yahoo.com/config/login?) POST /config/login? HTTP/1.1 Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */* Accept-Encoding: gzip, deflate Referer: https://login.yahoo.com/config/mail?.intl=us Accept-Language: en-us Content-Type: application/x-www-form-urlencoded The post request sends to the web server the username and password I enter to log in to my email account. What I want to do is to display the username and password along with the headers above. If someone has a clue on how to do this, I will appreciate your help. Thanks.

Share this post


Link to post
Share on other sites
POST parameters are simply stuffed into the body of the HTTP request, after the headers - there's a blank line separating the two. The data comes in the general format param1=value1&param2=value2.

The best way to get at that data depends an awful lot on what your program is doing and why. How exactly are you getting those headers?

Share this post


Link to post
Share on other sites
I am using the BeginningTransaction function to get the headers:

STDMETHODIMP CTestSink::BeginningTransaction(
/* [in] */ LPCWSTR szURL,
/* [in] */ LPCWSTR szHeaders,
/* [in] */ DWORD dwReserved,
/* [out] */ LPWSTR *pszAdditionalHeaders)

Is there any way to get the post parameters to display with the headers?


Thanks.

Share this post


Link to post
Share on other sites
The data (parameters input by user)is supposed to be followed by the headers of the post request, however, no data is displayed. After the post request headers, the response from the web server is displayed:

(Request for https://login.yahoo.com/config/login?)
POST /config/login? HTTP/1.1
Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, */*
Accept-Encoding: gzip, deflate
Referer: https://login.yahoo.com/config/mail?.intl=us
Accept-Language: en-us
Content-Type: application/x-www-form-urlencoded

(Response for https://login.yahoo.com/p.gif?t=1157687741&_ylp=A9FJsWa96QBFDF8ACAA51_AI&hp=0)
HTTP/1.1 200 OK
Date: Fri, 08 Sep 2006 03:56:13 GMT
P3P: policyref="http://p3p.yahoo.com/w3c/p3p.xml", CP="CAO DSP COR CUR ADM DEV TAI PSA PSD IVAi IVDi CONi TELo OTPi OUR DELi SAMi OTRi UNRi PUBi IND PHY ONL UNI PUR FIN COM NAV INT DEM CNT STA POL HEA PRE GOV"
Last-Modified: Thu, 22 Jun 2006 19:10:07 GMT
ETag: "2616d28-2b-449aeb0f"
Accept-Ranges: bytes
Content-Length: 43
Connection: close
Content-Type: image/gif

Share this post


Link to post
Share on other sites
I would recommend reading the documentation for functions before you design code around them. The URL moniker hooks do not provide access to the data stream as near as I can tell - only the actual headers. In my interpretation of the documentation, it isn't even guaranteed that the data stream will be assembled at the point in time when your code is called.

You will need to find an alternative point to hook traffic and extract the data you want.

Share this post


Link to post
Share on other sites
Thanks for your input, ApochPiQ. I am trying to work on the requirement. I found something on retrieving post data using the Start method of IInternetProtocol. But I'm not sure it it'll work.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this