Ik probeer een testscript te schrijven voor het Zope/Plone platform. In dit script probeer ik in te loggen en iets te posten op het PloneBoard. Inloggen werkt prima, een post doen op het ploneboard niet. Ik heb de instructies gevolgd op: HTTP::Request::Common - Construct common HTTP::Request objects - search.cpan.org om een multipart/form-data POST et doen maar het script stuurt niet wat het zou moeten sturen:
Uit wireshark, de data dat mijn script stuurt:
POST /Portaalsite/forum/forum-1/786586749/769741525/add_comment_form HTTP/1.1
Connection: close
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Host: x.x.x.x:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6
Content-Type: multipart/form-data
Content-Length: 7
The multipart dissector could not find the required boundary parameter.
Wat het zou moeten sturen:
[\POST /Portaalsite/forum/forum-1/786586749/769741525/add_comment_form HTTP/1.1
Host: x.x.x.x:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: nl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://x.x.x.x:8080/Porta...s_message=Comment%20added
Cookie: __ac="em9wZTp6b3Bl"
Content-Type: multipart/form-data; boundary=---------------------------42519183279600981512979745
Content-Length: 571
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="text_text_format:default"
text/html
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="text"
<p>blaat<br /></p>
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="form.submitted"
1
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="form.button.Post"
Plaats reactie
-----------------------------42519183279600981512979745--
Alvast bedankt voor replies
Uit wireshark, de data dat mijn script stuurt:
POST /Portaalsite/forum/forum-1/786586749/769741525/add_comment_form HTTP/1.1
Connection: close
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Host: x.x.x.x:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6
Content-Type: multipart/form-data
Content-Length: 7
The multipart dissector could not find the required boundary parameter.
Wat het zou moeten sturen:
[\POST /Portaalsite/forum/forum-1/786586749/769741525/add_comment_form HTTP/1.1
Host: x.x.x.x:8080
User-Agent: Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: nl,en-us;q=0.7,en;q=0.3
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://x.x.x.x:8080/Porta...s_message=Comment%20added
Cookie: __ac="em9wZTp6b3Bl"
Content-Type: multipart/form-data; boundary=---------------------------42519183279600981512979745
Content-Length: 571
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="text_text_format:default"
text/html
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="text"
<p>blaat<br /></p>
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="form.submitted"
1
-----------------------------42519183279600981512979745
Content-Disposition: form-data; name="form.button.Post"
Plaats reactie
-----------------------------42519183279600981512979745--
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
| #!/usr/bin/perl use warnings; use strict; use diagnostics; require LWP::UserAgent; require HTTP::Request::Common; require HTTP::Cookies; my $ua = LWP::UserAgent->new; my $headers = HTTP::Headers->new( 'User-Agent' => 'Mozilla/5.0 (X11; U; Linux i686; nl; rv:1.9.0.6) Gecko/2009020911 Ubuntu/8.04 (hardy) Firefox/3.0.6', 'Content_Type' => 'multipart/form-data', 'Accept' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', ); my $req = HTTP::Request->new( POST => 'http://x.x.x.x:8080/Portaalsite/forum/forum-1/786586749/769741525/add_comment_form', $headers, Content => ['form.submitted' => '1', 'text_text_format:default' => 'text/html', 'text' => 'blaablaaa', 'form.button.Post' => 'Plaats reactie',] ); my $response_to_discard = $ua->request($req); |
Alvast bedankt voor replies