I'm not seeing a difference between the request we make from Store Manager and the request sent from the relay browser. I think we also need to get a debug log of a relay request to see what KoL does differently, but that's only likely to be useful in the case where the Store Manager request fails.
Yes.Edit: of course, on closer inspection I see that log has my pwd in some of the urls. All I need to do is relog to prevent anyone from being able to abuse that info right?
but I do see long url's for both requests.
I don't. The request from browser seems to be a POST, and the long data is in request body, which does not have the same limit as URL.
"Requesting: https://www.kingdomofloathing.com/manageprices.php?action=update&..." appears in both the RelayRequest and the ManageStoreRequest. There's no way to tell whether GET or POST was used in the ManageStoreRequest, although just tracing through the code, I see no reason why it wouldn't have used POST.
Compiling reprice data...
Requesting store inventory...
class net.sourceforge.kolmafia.request.ManageStoreRequest
Connecting to manageprices.php...
Requesting: https://www.kingdomofloathing.com/manageprices.php?action=update&<many items>
3 request properties
Field: Cookie = [AWSELB=C33BB7571022FD5740A4FC773D31DA8D1ED6B251CD7AE0682626A8F1EB52E0DE763999DE5B52461F945C3DC559F3D6829D2C76CA633A88C8CD3C34D3A7F019EB68B6194C95; PHPSESSID=vmsm02c6qlq94bq4k620m2ugs4]
Field: User-Agent = [KoLmafia v17.2]
Field: Content-Type = [application/x-www-form-urlencoded]
-----From Browser-----
GET /manageprices.php HTTP/1.1
Host: 127.0.0.1:60080
Connection: keep-alive
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Referer: http://127.0.0.1:60080/mchat.php
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: inventory=0; szclosed=%7B%7D; chatpwd=436; charpwd=339
----------
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to manageprices.php...
Requesting: https://www.kingdomofloathing.com/manageprices.php
2 request properties
Field: Cookie = [inventory=0; szclosed=%7B%7D; chatpwd=436; charpwd=339; AWSELB=C33BB7571022FD5740A4FC773D31DA8D1ED6B251CD7AE0682626A8F1EB52E0DE763999DE5B52461F945C3DC559F3D6829D2C76CA633A88C8CD3C34D3A7F019EB68B6194C95; PHPSESSID=vmsm02c6qlq94bq4k620m2ugs4]
Field: User-Agent = [KoLmafia v17.2]
-----From Browser-----
POST /manageprices.php HTTP/1.1
Host: 127.0.0.1:60080
Connection: keep-alive
Content-Length: 62489
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Origin: http://127.0.0.1:60080
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.112 Safari/537.36
Content-Type: application/x-www-form-urlencoded
Referer: http://127.0.0.1:60080/manageprices.php
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.8
Cookie: inventory=0; szclosed=%7B%7D; chatpwd=436; charpwd=339
action=update&pwd&<many items>
----------
class net.sourceforge.kolmafia.request.RelayRequest
Connecting to manageprices.php...
Requesting: https://www.kingdomofloathing.com/manageprices.php?action=update&pwd&<many items>
3 request properties
Field: Cookie = [inventory=0; szclosed=%7B%7D; chatpwd=436; charpwd=339; AWSELB=C33BB7571022FD5740A4FC773D31DA8D1ED6B251CD7AE0682626A8F1EB52E0DE763999DE5B52461F945C3DC559F3D6829D2C76CA633A88C8CD3C34D3A7F019EB68B6194C95; PHPSESSID=vmsm02c6qlq94bq4k620m2ugs4]
Field: User-Agent = [KoLmafia v17.2]
Field: Content-Type = [application/x-www-form-urlencoded]
public ManageStoreRequest( final int[] itemId, final int[] prices, final int[] limits )
{
super( "manageprices.php" );
this.addFormField( "action", "update" );
int formInt;
this.requestType = ManageStoreRequest.PRICE_MANAGEMENT;
for ( int i = 0; i < itemId.length; ++i )
{
formInt = ( ( i - 1 ) / 100 ); //Group the form fields for every 100 items.
this.addFormField( "price" + formInt + "[" + itemId[ i ] + "]", prices[ i ] == 0 ? "" : String.valueOf( Math.max(
prices[ i ], Math.max( ItemDatabase.getPriceById( itemId[ i ] ), 100 ) ) ) );
this.addFormField( "limit" + formInt + "[" + itemId[ i ] + "]", String.valueOf( limits[ i ] ) );
}
}
@Override
public void actionConfirmed()
{
if ( !InputFieldUtilities.finalizeTable( StoreManageFrame.this.manageTable ) )
{
return;
}
KoLmafia.updateDisplay( "Compiling reprice data..." );
int rowCount = StoreManageFrame.this.manageTable.getRowCount();
int[] itemId = new int[ rowCount ];
int[] prices = new int[ rowCount ];
int[] limits = new int[ rowCount ];
SoldItem[] sold = new SoldItem[ StoreManager.getSoldItemList().size() ];
StoreManager.getSoldItemList().toArray( sold );
for ( int i = 0; i < rowCount; ++i )
{
String item = (String) StoreManageFrame.this.manageTable.getValueAt( i, 0 );
itemId[ i ] = ItemDatabase.getItemId( item );
prices[ i ] = ( (Integer) StoreManageFrame.this.manageTable.getValueAt( i, 1 ) ).intValue();
int cheapest = ( (Integer) StoreManageFrame.this.manageTable.getValueAt( i, 2 ) ).intValue();
if ( cheapest >= 1000000 && prices[ i ] < cheapest * 0.15 )
{
String message = item + ": the price is less than 15% of the cheapest in the mall, continue?";
if ( !InputFieldUtilities.confirm( message ) )
{
return;
}
}
int ilim = (Integer) StoreManageFrame.this.manageTable.getValueAt( i, 4 );
limits[ i ] = ilim > 0 ? ilim : 0;
}
RequestThread.postRequest( new ManageStoreRequest( itemId, prices, limits ) );
}
backoffice.php?action=updateinv&price[1907]=132&limit[1907]=0&ajax=1&pwd&_=1460864632340
backoffice.php?action=updateinv&ajax=1&pwd&price[1907]=131&limit[1907]=1&price[5254]=7800&limit[5254]=0
<script type="text/javascript">if (window.updateInv) updateInv([])</script><script type="text/javascript">if (!window.updateInv && parent.mainpane.updateInv) parent.mainpane.updateInv([])</script><center><table width=95% cellspacing=0 cellpadding=0><tr><td style="color: white;" align=center bgcolor=blue><b>Results:</b></td></tr><tr><td style="padding: 5px; border: 1px solid blue;"><center><table><tr><td>8-ball updated (price: 130, limit: 0)<!-- U:{"631597539":{"price":130,"lim":0}} --></td></tr></table></center></td></tr><tr><td height=4></td></tr></table></center>
var i;
var params = {
ajax: 1,
action: 'updateinv',
pwd: pwd
};
$('.deets').each(function (e){
i = $(this).find('.price');
params[i.attr('name')] = i.val();
i = $(this).find('.lim');
params[i.attr('name')] = i.val();
});
var lnk = $(this);
dojax('/backoffice.php', function (res){
lnk.html('update all');
if (m = res.match(/<!-- U:([^>]*) -->/)) {
updateRows(m[1]);
}
$('.hideit').hide();
$('.tohide').show();
$('.update').text('update');
}, null, null, 'POST', params);
...
function dojax(dourl, afterFunc, hoverCaller, failureFunc, method, params) {
$.ajax({
type: method || 'GET', url: dourl, cache: false,
data: params || null,
global: false,
success: irrelevant
});
}
public ManageStoreRequest( final int[] itemId, final int[] prices, final int[] limits )
{
super( "backoffice.php" );
this.addFormField( "action", "updateinv" );
this.requestType = ManageStoreRequest.PRICE_MANAGEMENT;
for ( int i = 0; i < itemId.length; ++i )
{
this.addFormField( "price" + "[" + itemId[ i ] + "]", prices[ i ] == 0 ? "" : String.valueOf( Math.max(
prices[ i ], Math.max( ItemDatabase.getPriceById( itemId[ i ] ), 100 ) ) ) );
this.addFormField( "limit" + "[" + itemId[ i ] + "]", String.valueOf( limits[ i ] ) );
}
}