Moin Leutz,
ich weiß dass bereits ansätze zum versenden eine formulars gibt.
Ich habe mich nun insperieren lassen von >Martin Honnen:
Er benutzt diesen Code
Alles anzeigen
um einen Request des ContentType: form-data zu bilden, allerdings wird in Firefox, für den meine Anwendung laufen soll der RequestHeader nciht richtig gebildet.
Alles anzeigen
Wie unschwer zu erkennen ist, befindet sich im Postbody des ContentTypes der Cookie, Pragma und Cache.
1. Setze ich das gar nciht
und 2. wenn es automatisch geschieht, warum wird es in den ContentType reingeschoben?
Wie kann ich das verhindern?
ich weiß dass bereits ansätze zum versenden eine formulars gibt.
Ich habe mich nun insperieren lassen von >Martin Honnen:
Er benutzt diesen Code
Quellcode
- var httpRequest = null;
- if (typeof XMLHttpRequest != 'undefined') {
- httpRequest = new XMLHttpRequest();
- }
- else if (typeof ActiveXObject != 'undefined') {
- // need try/catch here in reality
- httpRequest = new ActiveXObject('Microsoft.XMLHTTP');
- }
- if (httpRequest != null) {
- var boundaryString = 'AaB03x';
- var boundary = '--' + boundaryString;
- var requestBody = [
- boundary,
- 'Content-Disposition: form-data; name="GOD"',
- '',
- 'Kibo',
- boundary,
- 'Content-Disposition: file; name="prayer"; filename="prayer.txt"',
- 'Content-Type: text/plain',
- '',
- 'Kibology for all.\r\nAll for Kibology.',
- boundary
- ].join('\r\n');
- httpRequest.open('POST', 'test2005093002.php', true);
- if (typeof httpRequest.setRequestHeader != 'undefined') {
- httpRequest.setRequestHeader('Content-Type',
- 'multipart/form-data; boundary=' + boundaryString);
- httpRequest.onreadystatechange = function (evt) {
- if (httpRequest.readyState == 4) {
- alert(httpRequest.status + ' ' + httpRequest.statusText + '\r\n' +
- httpRequest.getAllResponseHeaders() + '\r\n\r\n' +
- httpRequest.responseText);
- }
- };
- httpRequest.send(requestBody);
- }
- }
um einen Request des ContentType: form-data zu bilden, allerdings wird in Firefox, für den meine Anwendung laufen soll der RequestHeader nciht richtig gebildet.
Quellcode
- REQUEST:
- http://localhost/wiki/index.php?title=Hauptseite&action=submit
- POST /wiki/index.php?title=Hauptseite&action=submit HTTP/1.1
- Host: localhost
- User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1) Gecko/20061010 Firefox/2.0
- Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
- Accept-Language: de-de,de;q=0.8,en-us;q=0.5,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
- Content-Type: multipart/form-data; boundary=--AaB03x
- Content-Length: 965
- Cookie: wikidb_session=6f835fabb3dfef69ae4a71aa8ab07e1d; wikidbUserID=2; wikidbUserName=Cybo
- Pragma: no-cache
- Cache-Control: no-cache
- --AaB03x
- Content-Disposition: form-Data; name="wpSection"
- --AaB03x
- Content-Disposition: form-Data; name="wpStarttime"
- 20061124162705
- --AaB03x
- Content-Disposition: form-Data; name="wpEdittime"
- 20061124150006
- --AaB03x
- Content-Disposition: form-Data; name="wpScrolltop"
- --AaB03x
- Content-Disposition: form-Data; name="wpTextbox1"
- MediaWiki wurde erfolgreich installiert.
- Hilfe zur Benutzung und Konfiguration der Wiki
- --AaB03x
- Content-Disposition: form-Data; name="wpSummary"
- --AaB03x
- Content-Disposition: form-Data; name="wpSave"
- Seite speichern
- --AaB03x
- Content-Disposition: form-Data; name="wpDiff"
- Änderungen zeigen
- --AaB03x
- Content-Disposition: form-Data; name="wpEditToken"
- 6aaf26964c2d13e2e52fea7b016faad1
- --AaB03x
- Content-Disposition: form-Data; name="wpAutoSummary"
- d41d8cd98f00b204e9800998ecf8427e
- --AaB03x
Wie unschwer zu erkennen ist, befindet sich im Postbody des ContentTypes der Cookie, Pragma und Cache.
1. Setze ich das gar nciht
und 2. wenn es automatisch geschieht, warum wird es in den ContentType reingeschoben?
Wie kann ich das verhindern?