flat assembler
Message board for the users of flat assembler.

Index > Windows > windows HTTP strange problem

Author
Thread Post new topic Reply to topic
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001
First of all, apologize in advance for my poor English, I'm a Chinese.
I'm testing an HTTP program,
which will simply send some data to the server and get a respond.
see attachment for the program.
see this link for testing:
http://www.easy-creator.net/test2/test.asp


this program always fail, or just in my computer?
I'm running win7-64bit,
I've pre-set a debug break on where the error will occur and put a comment there

and it wont get correct result,
when WinHTTPAddRequestHeader was removed,
this program will run,
but wont get a correct result,
when the web page is opened,
it shows nothing,
no posted data


Description:
Filesize: 12.76 KB
Viewed: 917 Time(s)

2012-02-17_223731.png


Description:
Filesize: 23.99 KB
Viewed: 919 Time(s)

2012-02-17_223407.png


Description:
Download
Filename: HTTP.ASM
Filesize: 2.94 KB
Downloaded: 91 Time(s)

Post 17 Feb 2012, 14:30
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
The problem is that you are passing the wrong length, it should be sizeof.wcHeader/2 (i.e. the number of chars, not bytes). Since your string is zero-terminated, you could just pass -1 and forget about dealing with lengths.
Post 17 Feb 2012, 18:01
View user's profile Send private message Reply with quote
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001
LocoDelAssembly wrote:
The problem is that you are passing the wrong length, it should be sizeof.wcHeader/2 (i.e. the number of chars, not bytes). Since your string is zero-terminated, you could just pass -1 and forget about dealing with lengths.


oops, I just forgot the unicode/ascii problems...
msdn told me that, just missed it ....

but why my program can't post data to the server?
first of all, I used ascii: "test=1111232...",
and when I interrupted the send package,
I did see that it was send to the server,
why I can't see a result?
Post 18 Feb 2012, 08:45
View user's profile Send private message ICQ Number Reply with quote
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001
caoyunbin001 wrote:
LocoDelAssembly wrote:
The problem is that you are passing the wrong length, it should be sizeof.wcHeader/2 (i.e. the number of chars, not bytes). Since your string is zero-terminated, you could just pass -1 and forget about dealing with lengths.


oops, I just forgot the unicode/ascii problems...
msdn told me that, just missed it ....

but why my program can't post data to the server?
first of all, I used ascii: "test=1111232...",
and when I interrupted the send package,
I did see that it was send to the server,
why I can't see a result?



nothin~ nothin~ forget about it ....
it works ,
just need that header so it can work...
but why?
why that header is necessary?
who can tell me ?
thanks in advance...
Post 18 Feb 2012, 08:47
View user's profile Send private message ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
I believe you mean the Content-Type header? The web server needs it to know what are you sending to it (remember that POST is also used to send files for instance). When you use "application/x-www-form-urlencoded" the ASP engine knows that it must set up the Request.Form array with the data you supplied (or whatever means ASP provides to read form data, I don't know ASP much)
Post 18 Feb 2012, 17:55
View user's profile Send private message Reply with quote
caoyunbin001



Joined: 21 Jan 2012
Posts: 20
caoyunbin001
LocoDelAssembly wrote:
I believe you mean the Content-Type header? The web server needs it to know what are you sending to it (remember that POST is also used to send files for instance). When you use "application/x-www-form-urlencoded" the ASP engine knows that it must set up the Request.Form array with the data you supplied (or whatever means ASP provides to read form data, I don't know ASP much)


Thanks,
Helped a lot.
Post 21 Feb 2012, 12:04
View user's profile Send private message ICQ Number Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.