The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: statis on April 20, 2011, 05:27:57 PM

Title: multipart/form-data; boundary=-----1234 ?
Post by: statis on April 20, 2011, 05:27:57 PM
Hello,

I need documentation to wininet part multipart/form-data...

I have find forum sample's but isn't easy for me anderstand data's.

multipart/form-data; boundary=-----1234 ? is unknow language for me.

I have used wininet functions to open session, send request, read data's (tanks to Farabi) but i'm stopped with request to intranet http page's need multipart/form-data sending.

I don't andertand the way to build header and other operations for transmit data's on this formulary type's.

Have you global process sample ?

Thanks all

Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: oex on April 20, 2011, 05:34:44 PM
It isnt wininet documentation you need but documentation for the HTTP protocol....
http://www.w3.org/Protocols/rfc2616/rfc2616.html

I dont know if you'll find an asm example in wininet however there are many examples in other languages on google
http://code.activestate.com/recipes/146306-http-client-to-post-using-multipartform-data/
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: statis on April 21, 2011, 09:59:48 PM
Thanks Oex,

For the fisrt link i do read but now i haven't time, later...

For second link i can't find in this code wininet referencies and sorry i'm not expert with masm but totaly null on other languages.

I have traced web broswer request with wireshark on my multipart form but now i haven't time, later...

I go back later...
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: oex on April 21, 2011, 10:21:02 PM
Quote from: statis on April 21, 2011, 09:59:48 PM
For second link i can't find in this code wininet referencies and sorry i'm not expert with masm but totaly null on other languages.

For the second link this is not wininet but python sorry but it shows pretty simply the process you need to perform.... Just search Google for wininet examples....
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: statis on April 24, 2011, 07:02:54 PM
Thanks Oex,

I have search on first link and finded this
multipart :
http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7.2
boundary :
http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html#sec19.2
range :
http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.16
Yes, but isn't a way to use wininet...
I have anderstand boundary is simple separate, is good  :U

Masm isn't easy to find samples, for simple functions yes but it's another story for search dll windows correct's use, and google ISN'T my friend (for commercial search's i like).

Wininet is dead, Winhttp is born, but winhttp doesn't work with masm32.

Assembly is prehistoric language for neanderthal man's  :'(

Thanks at all's, and good bye
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: statis on June 30, 2011, 02:35:49 PM
I'm back,

Before long long time to searching, i have no solution...

I have andestand boundary, "--boundary" for the first element and "--boundary--" for last

I used this sample :
http://www.w3.org/TR/html401/interac...ml#h-17.13.4.2

and make test with :

text1 db "Content-Type: multipart/form-data; boundary=AaB03x",0dh,0ah,0dh,0ah,0 ;tested to with only one CRLF i have same result

invoke HttpAddRequestHeaders,hRequest,offset text1,-1,HTTP_ADDREQ_FLAG_ADD

request part is send with no error

for next step :

text2 db "--AaB03x",0dh,0ah,0 ;tested to without CLRF  i have same result

invoke HttpAddRequestHeaders,hRequest,offset text2,-1,HTTP_ADDREQ_FLAG_ADD

and i have 87 error (057h), windows doesn't send request part, idon't see on wireshark monitoring

if error is bypassed and next rerquest part send :

db 'Content-Disposition: form-data; name="....'+HttpAddRequestHeaders

no error, i see request part on  monitoring but i have not server answering

If i send completly request with boundary include and second part i have same error

boundary isn't my friend, it's your ?

Thanks to all
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: dedndave on June 30, 2011, 03:23:37 PM
this thread may be helpful...
http://www.masm32.com/board/index.php?topic=13237.msg103388#msg103388
Title: Re: multipart/form-data; boundary=-----1234 ?
Post by: statis on June 30, 2011, 03:54:18 PM
Quote from: dedndave on June 30, 2011, 03:23:37 PM
this thread may be helpful...
http://www.masm32.com/board/index.php?topic=13237.msg103388#msg103388

Thanks dednave,

I know this post but it's winsock process, my code part's on multipart access is very small, i can't transpose all code in winsocking access.

This post use boundary with boundary=-----1234 declaration and use -----1234 for separate, i don't andestand normally separate do --boundary and if transposed -----1234 i do have -------1234
Normally last boundary do --boundary-- i don't find -------1234-- in this post.

I do use wininet, i have not another way, i need solution to send boundary correctly with HttpAddRequestHeaders or with other wininet api.