Login | Register
My pages Projects Community openCollabNet

Discussions > users > Re: [maxq-users] Attachments not supported?

maxq
Discussion topic

Back to topic list

Re: [maxq-users] Attachments not supported?

Author saperski
Full name Marcin Cieslak
Date 2005-09-28 04:22:47 PDT
Message 2005/9/26, Frank Cohen <fcohen at pushtotest dot com>:
> MaxQ supports multi-part form submits. Posting the snippet of
> recorded script may help me find the problem. -Frank

Really? Looks to me that it attempts to simulate multipart request
with stuffing variables in the URL-encoded form into the "data" attachment.

I found this in com/bitmechanic/maxq​/HttpTestCase.java:

    public void postMultiPart(String url, String data, int contLen,
Object[] args) throws IOException {
        cleanupMethod();
        url = replaceURL(url);

        MultipartPostMethod multipartPost = new MultipartPostMethod(url);
        multipartPost.addPart(new StringPart("data", data));
        if(args != null) {
            multipartPost.setQue​ryString(paramsToNV(​args));
        }

        method = multipartPost;
        method.setFollowRedi​rects(followRedirect​s);
        client.executeMethod(method);
    }

So normal variables sent via form MAY work (if their values are not
too large for example),
but attachements definitely won't.

I did a small testcase, form in attached test.html file.

Attempt to record submit to this form in compact script with maxq pops
up empty message window and raises exception:

java.lang.AssertionError
        at com.bitmechanic.maxq​.generator.AbstractC​odeGenerator.setMult​iPartData(AbstractCo​deGenerator.java:422​)
        at com.bitmechanic.maxq​.generator.AbstractC​odeGenerator.process​Request(AbstractCode​Generator.java:341)
        at com.bitmechanic.maxq​.ProxyServer.process​Request(ProxyServer.​java:113)
        at com.bitmechanic.maxq​.RequestHandler.run(​RequestHandler.java:​211)
        at java.lang.Thread.run​(Thread.java:534)

Normal POST without proxy ends up with (there are extra newlines due
to copy-paste)

POST /video/submit.html HTTP/1.0

User-Agent: w3m/0.5.1

Accept: text/*, image/*

Accept-Encoding: gzip, compress, bzip, bzip2, deflate

Accept-Language: en;q=1.0

Host: localhost

Referer: http://localhost/vid​eo/test.html

Content-type: multipart/form-data;
boundary=-----------​-------------------8​19713528666413529867​20

Content-length: 415



--------------------​------------81971352​866641352986720

Content-Disposition: form-data; name="file1"; filename="motd"

Content-Type: application/octet-stream



FreeBSD 5.4-PRERELEASE (VAIO) #0: Mon Mar 14 18:50:08 CET 2005

Welcome to FreeBSD!



--------------------​------------81971352​866641352986720

Content-Disposition: form-data; name="txt"



OK

--------------------​------------81971352​866641352986720--

And what maxq receives via proxy is:

POST http://localhost/vid​eo/submit.html HTTP/1.1

Host: localhost

User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.8)
Gecko/20050530 Firefox/1.0.4

Accept: text/xml,application​/xml,application/xht​ml+xml,text/html;q=0​.9,text/plain;q=0.8,​image/png,*/*;q=0.5

Accept-Language: pl,en-us;q=0.8,en;q=​0.7,de-de;q=0.5,de;q​=0.3,ru;q=0.2

Accept-Encoding: gzip,deflate

Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7

Keep-Alive: 300

Proxy-Connection: keep-alive

Referer: http://localhost/vid​eo/test.html

Content-Type: multipart/form-data;
boundary=-----------​----------------1144​10893047021127210102​7544

Content-Length: 421



--------------------​---------11441089304​70211272101027544

Content-Disposition: form-data; name="file1"; filename="motd"

Content-Type: application/octet-stream



FreeBSD 5.4-PRERELEASE (VAIO) #0: Mon Mar 14 18:50:08 CET 2005

Welcome to FreeBSD!



--------------------​---------11441089304​70211272101027544

Content-Disposition: form-data; name="txt"



OK

--------------------​---------11441089304​70211272101027544--


Actually I got some real-life form to work and the result was that all
form variables
were stuffed in the urlencoded form...

--Marcin
Attachments

« Previous message in topic | 5 of 6 | Next message in topic »

Messages

Show all messages in topic

Attachments not supported? Rahul Dev <rahuldevblore at yahoo dot com> Rahul Dev <rahuldevblore at yahoo dot com> 2005-09-24 11:43:13 PDT
     Re: [maxq-users] Attachments not supported? fcohen Frank Cohen 2005-09-25 15:36:29 PDT
         Re: [maxq-users] Attachments not supported? Rahul Dev <rahuldevblore at yahoo dot com> Rahul Dev <rahuldevblore at yahoo dot com> 2005-09-27 14:31:55 PDT
             Re: [maxq-users] Attachments not supported? fcohen Frank Cohen 2005-09-28 02:21:41 PDT
         Re: [maxq-users] Attachments not supported? saperski Marcin Cieslak 2005-09-28 04:22:47 PDT
             Re: [maxq-users] Attachments not supported? oliverbock Oliver Bock 2005-09-28 16:00:52 PDT
Messages per page: